Issue found on global run but not on single file run
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Hello,
I have some code with a false positive, approximatively:
def _stream_fetchone_gen(self) -> Optional["PGresult"]:
# code, code, code
self._raise_from_results([res])
return None # TODO: shouldn't be needed
def _raise_from_results(self, results: Sequence["PGresult"]) -> NoReturn:
raise # something unconditionally
As the TODO says, I would have expected the return not being needed. However, the problem is that the issue is reported only in a mypy run with no arguments, and not if that single file is processed.
Steps to reproduce:
git clone git@github.com:psycopg/psycopg3.git
cd psycopg3
git reset --hard 8429be5
pip install mypy==0.800
sed -i "/be needed/d" psycopg3/psycopg3/cursor.py
cd psycopg3
mypy
# psycopg3/cursor.py:257: error: Missing return statement [return]
# Found 1 error in 1 file (checked 42 source files)
mypy psycopg3/cursor.py
# Success: no issues found in 1 source file
mypy version is 0.800 on Python 3.8.5 on Linux. mypy.ini is included in the repos.
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
Beginnen Sie damit, die Abweichung mit mypy==0.800 unter Verwendung des Commits, von psycopg3/psycopg3/cursor.py und der enthaltenen mypy.ini zu reproduzieren. Vergleichen Sie den vollständigen Projektlauf von mypy mit mypy psycopg3/cursor.py, und verfolgen Sie anschließend, warum sich ihre Rückgabeanalyse unterscheidet. Die Aufgabe ist erledigt, wenn die Abweichung erklärt und der gemeldete False Positive behoben ist, ohne eine der beiden Aufrufvarianten zu regressieren.
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
- 45/100