AssertionError: Internal error: method must be called on parsed file only
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug Report
When I run mypy==0.991 in parallel, the following error randomly happens.
Traceback (most recent call last):
File "/home/my_name/.pyenv/versions/3.9.16/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/my_name/.pyenv/versions/3.9.16/lib/python3.9/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "mypy/main.py", line 95, in main
File "mypy/main.py", line 174, in run_build
File "mypy/build.py", line 193, in build
File "mypy/build.py", line 276, in _build
File "mypy/build.py", line 2903, in dispatch
File "mypy/build.py", line 3284, in process_graph
File "mypy/build.py", line 3365, in process_fresh_modules
File "mypy/build.py", line 2109, in fix_cross_refs
AssertionError: Internal error: method must be called on parsed file only
To Reproduce
I cannot identify to reproduce this problem because this error randomly happens (2-3% probabiliy), but I observed this problem only when I ran mypy in parallel on multiple files.
Your Environment
- Mypy version used: mypy==0.991
- Mypy command-line flags:
mypy --follow-imports silent --config-file pyproject.toml path/to/foo.py - Mypy configuration options from
mypy.ini(and other config files): pyproject.toml
[tool.mypy]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "third_party.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "requests.*"
ignore_missing_imports = true
- Python version used:3.9.16
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
Beginne in mypy/build.py bei process_fresh_modules, fix_cross_refs und den umgebenden dispatch- und process_graph-Aufrufen, die im Traceback gezeigt werden. Führe den gemeldeten mypy==0.991-Befehl gleichzeitig für mehrere Dateien aus und konzentriere dich auf den intermittierenden Fehler bei paralleler Ausführung. Fertig ist die Änderung, wenn die Assertion bei parallelen Läufen nicht mehr auftritt und die Regression durch einen reproduzierbaren Test abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100