--disallow-untyped-calls allows calling values with Any type
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
The calls to f and ff below aren't rejected when using --disallow-untyped-calls, even though I believe that they should be:
from typing import Any
from non_existent import f # type: ignore # Not in the build
def g(): pass
def h() -> None:
g(asdf=1) # Error: Call to untyped function "g" in typed context
f(asdf=1) # No error reported, but this is untyped
ff: Any
ff() # No error reported, and again this in untyped
At the very least the first call should probably be caught. If non_existent gets added in the build with no type annotations, it would start generating errors. However, I'd expect that adding a module to the build should result in fewer Any-related errors, not more.
Marking this a high priority since I've been bit by this twice in production code.
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 das Python-Beispiel des Issues mit --disallow-untyped-calls und verfolge dann, wie Aufrufe über importierte und explizit als Any typisierte Werte geprüft werden. Als erledigt gilt, wenn die Aufrufe von f und ff abgelehnt werden, ohne die bestehende Diagnose für g zu ändern; der Payload nennt keine Quelldatei und keinen Test, mit dem begonnen werden soll.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- compilers, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 39/100