Skip to content

conbytes doesn't accept strict option #2489

@koxudaxi

Description

@koxudaxi

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and still think this is a bug

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

python -c "import pydantic.utils; print(pydantic.utils.version_info())"
             pydantic version: 1.8.1
            pydantic compiled: True
                 install path: /Users/koudai/Library/Caches/pypoetry/virtualenvs/pythonproject10-AaXGgRf_-py3.9/lib/python3.9/site-packages/pydantic
               python version: 3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23)  [Clang 6.0 (clang-600.0.57)]
                     platform: macOS-10.15.7-x86_64-i386-64bit
     optional deps. installed: ['email-validator', 'typing-extensions']
from pydantic import BaseModel, conbytes


class Model(BaseModel):
    data: conbytes(strict=True)
...

Output

Traceback (most recent call last):
  File "/Users/koudai/PycharmProjects/pythonProject10/main.py", line 4, in <module>
    class Model(BaseModel):
  File "/Users/koudai/PycharmProjects/pythonProject10/main.py", line 5, in Model
    data: conbytes(strict=True)
  File "pydantic/types.py", line 340, in pydantic.types.conbytes
TypeError: conbytes() got an unexpected keyword argument 'strict'

conbytes is supposed to accept strict=True
Becuse ConstrainedBytes has strict field.

I will create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug V1Bug related to Pydantic V1.X

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions