-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.8.2
pydantic compiled: True
install path: /home/xxx/.conda/envs/py38/lib/python3.8/site-packages/pydantic
python version: 3.8.5 (default, Sep 4 2020, 07:30:14) [GCC 7.3.0]
platform: Linux-4.18.0-80.el8.x86_64-x86_64-with-glibc2.10
optional deps. installed: ['typing-extensions']
underscore_attrs_are_private not work with validate_arguments just like it not work with create_model #3134 .
When I define a function decorated by validate_arguments with validate_all been set True, It will raise ValidationError:
from datetime import datetime
from pydantic import validate_arguments, Field
@validate_arguments(config={'validate_all': True})
def foo(dt: datetime = Field(default_factory=lambda : 42)):
print(type(dt))
foo()---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
<ipython-input-4-6c97ede6fd47> in <module>
7 print(type(dt))
8
----> 9 foo()
~/.conda/envs/py38/lib/python3.8/site-packages/pydantic/decorator.cpython-38-x86_64-linux-gnu.so in pydantic.decorator.validate_arguments.validate.wrapper_function()
~/.conda/envs/py38/lib/python3.8/site-packages/pydantic/decorator.cpython-38-x86_64-linux-gnu.so in pydantic.decorator.ValidatedFunction.call()
~/.conda/envs/py38/lib/python3.8/site-packages/pydantic/decorator.cpython-38-x86_64-linux-gnu.so in pydantic.decorator.ValidatedFunction.init_model_instance()
~/.conda/envs/py38/lib/python3.8/site-packages/pydantic/main.cpython-38-x86_64-linux-gnu.so in pydantic.main.BaseModel.__init__()
ValidationError: 3 validation errors for Foo
v__duplicate_kwargs
object of type 'NoneType' has no len() (type=type_error)
args
object of type 'NoneType' has no len() (type=type_error)
kwargs
object of type 'NoneType' has no len() (type=type_error)
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X