-
-
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
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
When using a NamedTuple as a field in a pydantic model, it cannot have arbitrary types - even if arbitrary_types_allowed is True on the model. I found that when create_model_from_namedtuple is called, config is not passed (but for TypedDict, it is passed).
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.9.1
pydantic compiled: True
install path: /home/rory/lab/mres/task/co/.venv/lib/python3.9/site-packages/pydantic
python version: 3.9.13 (main, May 27 2022, 11:07:19) [GCC 12.1.0]
platform: Linux-5.18.7-arch1-1-x86_64-with-glibc2.35
optional deps. installed: ['typing-extensions']
from typing import NamedTuple
import pydantic
class Foo:
pass
class Bar(NamedTuple):
foo: Foo
class MyModel(pydantic.BaseModel):
bar: Bar
class Config:
arbitrary_types_allowed = TrueMetadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
