10000 Mypy crashes with 1.11.1 version and Pydantic 1.10.11 · Issue #10129 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Mypy crashes with 1.11.1 version and Pydantic 1.10.11 #10129

New issue
8000

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

Closed
5 of 15 tasks
OmerFI opened this issue Aug 14, 2024 · 2 comments
Closed
5 of 15 tasks

Mypy crashes with 1.11.1 version and Pydantic 1.10.11 #10129

OmerFI opened this issue Aug 14, 2024 · 2 comments
Labels
bug V1 Bug related to Pydantic V1.X pending Is unconfirmed

Comments

@OmerFI
Copy link
OmerFI commented Aug 14, 2024

Initial Checks

  • 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

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

NOTE

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

pydantic version: 1.10.11
            pydantic compiled: True
                 install path: /home/omerfi/mypyfailproject/.venv/lib/python3.10/site-packages/pydantic
               python version: 3.10.13 (main, Dec  5 2023, 01:05:27) [GCC 11.4.0]
                     platform: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
     optional deps. installed: ['typing-extensions']

Affected Components

@OmerFI OmerFI added bug V1 Bug related to Pydantic V1.X pending Is unconfirmed labels Aug 14, 2024
@Viicos
Copy link
Member
Viicos commented Aug 14, 2024

This was fixed in Pydantic 1.10.16 (see #9586).

@Viicos Viicos closed this as completed Aug 14, 2024
@OmerFI
Copy link
Author
OmerFI commented Aug 14, 2024

Thank you 🚀🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X pending Is unconfirmed
Projects
None yet
Development

No branches or pull requests

2 participants
0