Using the pre-commit mypy plugin throws internal library errors
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Using the pre-commit implementation of mypy throws an INTERNAL ERROR on a project that was previously working. Note that running the same version of mypy from the command line against the same files (in a devcontainer) works as expected.
Pre-commit project can be found at: https://github.com/pre-commit/pre-commit Version 4.3.0
From the pre-commit configuration: running mypy v1.18.2
To Reproduce
Create python project, configure git and install the pre-commit hook
Expected Behavior
Expected to run mypy testing on changed files as usual.
Actual Behavior
vscode ➜ /workspace/internalapi (internalapi_apm_and_logs) $ pre-commit run mypy
mypy.....................................................................Failed
- hook id: mypy
- exit code: 2
/home/vscode/.cache/pre-commit/repo3uyifmwv/py_env-python3.12/lib/python3.12/site-packages/django-stubs/http/request.pyi:56: 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.18.2
Traceback (most recent call last):
File "mypy/semanal.py", line 7350, in accept
File "mypy/nodes.py", line 1624, in accept
File "mypy/semanal.py", line 3272, in visit_assignment_stmt
File "mypy/semanal.py", line 3806, in process_type_annotation
File "mypy/semanal.py", line 6996, in defer
AssertionError: Must not defer during final iteration
/home/vscode/.cache/pre-commit/repo3uyifmwv/py_env-python3.12/lib/python3.12/site-packages/django-stubs/http/request.pyi:56: : note: use --pdb to drop into pdb
Your Environment
- Mypy version used: 1.18.2
- Mypy command-line flags: --show-traceback, --check-untyped-defs, --ignore-missing-imports, --config-file=pyproject.toml
- Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.12
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fehler mit pre-commit run mypy unter Verwendung von Python 3.12, mypy 1.18.2 und den aufgeführten Flags und vergleiche ihn anschließend mit dem Aufruf über die Befehlszeile. Beginne beim Traceback des semantischen Analysators in mypy/semanal.py und bei der Annotation in django-stubs/http/request.pyi:56. Die Aufgabe ist erledigt, wenn der pre-commit-Hook bei der Prüfung derselben Dateien ohne den INTERNAL ERROR abgeschlossen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100