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
I have searched GitHub for a duplicate issue and I'm sure this is something new
I have searched Google & StackOverflow for a solution and couldn't find anything
I have read and followed the docs and still think this is a bug
I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like FastAPI or mypy)
Description
Crash Report
Updated mypy to 1.11.1 version. Run mypy and faced with error.
It doesn't crash with mypy 1.10.1
Traceback
❯ mypy xxx/ --show-traceback
/home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.11.1
Traceback (most recent call last):
File "mypy/semanal.py", line 7092, in accept
File "mypy/nodes.py", line 1183, in accept
File "mypy/semanal.py", line 1700, in visit_class_def
File "mypy/semanal.py", line 1891, in analyze_class
File "mypy/semanal.py", line 1925, in analyze_class_body_common
File "mypy/semanal.py", line 2010, in apply_class_plugin_hooks
File "pydantic/mypy.py", line 154, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback
File "pydantic/mypy.py", line 317, in pydantic.mypy.PydanticModelTransformer.transform
File "pydantic/mypy.py", line 497, in pydantic.mypy.PydanticModelTransformer.add_construct_method
File "mypy/types.py", line 607, in __init__
TypeError: mypy.types.TypeVarId object expected; got int
/home/omerfi/xxx/.venv/lib/python3.10/site-packages/pydantic/env_settings.py:23: : note: use --pdb to drop into pdb
Initial Checks
Description
Crash Report
Updated mypy to 1.11.1 version. Run mypy and faced with error.
It doesn't crash with mypy 1.10.1
Traceback
To Reproduce
I created a POC repository. You can follow the instructions in the README and face the error yourself: https://github.com/OmerFI/mypyfailproject
Your Environment
mypy.ini
(and other config files): https://github.com/OmerFI/mypyfailproject/blob/main/mypy.iniNOTE
I actually opened an issue with the same description in mypy repository and they said it's a pydantic issue: python/mypy#17671
Example Code
# check https://github.com/OmerFI/mypyfailproject
Python, Pydantic & OS Version
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: