You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading from pydantic 2.4.2 to 2.5.1, model fields of type BaseModel | Literal[True] or BaseModel | Literal[False] can no longer be instantiated using a model dict.
Traceback (most recent call last):
File ".../test.py", line 10, in <module>
Bar(foo={"x": 42})
File ".../.pyenv/versions/test-pydantic25/lib/python3.11/site-packages/pydantic/main.py", line 164, in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
TypeError: unhashable type: 'dict'
This does look like a bug introduced by our most recent minor release. Thanks for reporting this. We'll look into a fix to get out with our next patch release.
Initial Checks
Description
When upgrading from pydantic 2.4.2 to 2.5.1, model fields of type
BaseModel | Literal[True]
orBaseModel | Literal[False]
can no longer be instantiated using a modeldict
.Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: