-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.8.1
pydantic compiled: False
install path: [...]/lib/python3.9/site-packages/pydantic
python version: 3.9.2 (default, Feb 21 2021, 06:38:26) [Clang 7.1.0 (tags/RELEASE_710/final)]
platform: macOS-10.14.6-x86_64-i386-64bit
optional deps. installed: ['typing-extensions']
import pydantic
class Foo(pydantic.BaseModel):
class Config:
json_encoders = {int: str}
print('Foo json_encoders:', Foo.__config__.json_encoders)
class Bar(pydantic.BaseModel, json_encoders={int: str}):
pass
print('Bar json_encoders:', Bar.__config__.json_encoders)Output:
Foo json_encoders: {<class 'int'>: <class 'str'>}
Bar json_encoders: {}
Culprit:
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X