python / python/mypy

Error location show incorrect file.

Offen
#16,175 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug priority-0-high topic-usability
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Following up on issue https://github.com/HypothesisWorks/hypothesis/issues/3753: the failing example in that issue always shows the test.py file as the originating file, which is incorrect:

test.py:1139:50: error: Cannot use a covariant type variable as a parameter  [misc]

The file containing the failing type check is called from test.py.

To Reproduce

See the referenced issue: install Hypothesis and mypy using the mentioned versions, and run the example.

Expected Behavior

Error location should show the file that contains the failing type check.

Actual Behavior

Error location shows the file file that contains the call to the failing type check.

Your Environment

  • Mypy version used: 1.5.1
  • Mypy command-line flags: mypy --show-traceback --config-file pyproject.toml test.py
  • Mypy configuration options from pyproject.toml:
    
     [tool.mypy]
     # mypy_path =
     # exclude =
     show_error_codes = true
     show_column_numbers = true
     check_untyped_defs = true
     incremental = false
     strict_equality = true
     warn_return_any = true
     warn_redundant_casts = true
     warn_unreachable = true
     warn_unused_configs = true
     warn_unused_ignores = true
     disallow_untyped_calls = true
     disallow_untyped_defs = true
     disallow_incomplete_defs = true
     disallow_untyped_decorators = true
     disable_error_code = []
     
     [[tool.mypy.overrides]]
     module = [
     ]
     ignore_missing_imports = true
    
  • Python version used: python 3.10.13 (main, Aug 25 2023, 01:44:57) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Reproduktion im referenzierten Hypothesis-Issue und verwende dabei test.py, pyproject.toml sowie den gemeldeten mypy-Befehl und die gemeldeten Versionen. Verfolge, wie die Position der fehlschlagenden Typprüfung ausgewählt wird, statt der Position des Aufrufers, und überprüfe anschließend, dass die Diagnose die Datei angibt, die die fehlschlagende Prüfung enthält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.