Issue found on global run but not on single file run
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the discrepancy with mypy==0.800 using the commit, psycopg3/psycopg3/cursor.py, and the included mypy.ini. Compare the full-project mypy run with mypy psycopg3/cursor.py, then trace why their return analysis differs. Done means the discrepancy is explained and the reported false positive is resolved without regressing either invocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100