-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GenericModel
calling get_args()
which is not hashable
#4551
Labels
bug V1
Bug related to Pydantic V1.X
Comments
This was referenced Sep 22, 2022
Closed
mfulgo
added a commit
to mfulgo/pydantic
that referenced
this issue
Oct 24, 2022
Introduced in 1.10.2, a TypeError would be raised upon creation of a GenericModel class that used a Callable type parameter. This would happen when `typing.get_args` returned a list for the first type agruments in a Callable and pydantic would try to use the value as a dictionary key. To avoid the issue, we convert the list to a tuple before using it as a key. The possible approach of modifying pydantic's `get_args` function to return a tuple instead of a list didn't work out because the return values are used in more places, some of which expect the list and not a tuple. Fixes pydantic#4551
samuelcolvin
added a commit
that referenced
this issue
Oct 31, 2022
* Fix TypeError for GenericModel with Callable param Introduced in 1.10.2, a TypeError would be raised upon creation of a GenericModel class that used a Callable type parameter. This would happen when `typing.get_args` returned a list for the first type agruments in a Callable and pydantic would try to use the value as a dictionary key. To avoid the issue, we convert the list to a tuple before using it as a key. The possible approach of modifying pydantic's `get_args` function to return a tuple instead of a list didn't work out because the return values are used in more places, some of which expect the list and not a tuple. Fixes #4551 * change as markdown Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Fixed by #4653 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #4482 (comment)
From @pepastach
Reply from @sveinugu
The text was updated successfully, but these errors were encountered: