Skip to content

Mypy crashes with 1.11.1 version and Pydantic 1.10.11 #17671

Closed as not planned
Closed as not planned
@OmerFI

Description

@OmerFI

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions