Skip to content

Enable warn_unreachable = True for mypyc and all other files as well #19050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wyattscarpenter
Copy link
Contributor

Achieves a todo, enabling warn_unreachable = True for mypyc and all other files as well

@wyattscarpenter
Copy link
Contributor Author

wyattscarpenter commented May 8, 2025

I am now waiting on mypyc/mypyc#1101 to be resolved to finish this issue, after which I will have to rebase this branch onto master to get the resolution.

This comment has been minimized.

@sterliakov
Copy link
Collaborator

Wow, only one hit? That should be easy to resolve...

@wyattscarpenter
Copy link
Contributor Author

wyattscarpenter commented May 10, 2025

@stanislavlevin, yep! Only one hit for this project 🥳! Unfortunately (so to speak), deciding what to do about that is best left to people more familiar with mypyc than me.

I could simply comment out this code, which I might do eventually, but if someone with a better idea about what it should do comes along, I will defer to them.

JukkaL pushed a commit that referenced this pull request Jun 5, 2025
Supplements #19050. The old version did certainly contain unreachable
code, as otherwise that branch would have crashed, there is no
`type_args` attribute. This block was introduced in #17027 - probably as
a future-proof expansion to generic primitive operations, but it makes
no sense now, this logic can be added back should it become necessary.

This comment has been minimized.

@wyattscarpenter
Copy link
Contributor Author

Hmm, another hit. I guess it was masked or subsequently developed or something...
Running the self-check on my computer, with python 3.9, doesn't produce this problem, even with --python-version 3.9 🤔. So I guess it's an actual python language behavior change...

@wyattscarpenter
Copy link
Contributor Author

wyattscarpenter commented Jun 7, 2025

Even after installing python 3.9 I can't reproduce this. Odd.

I'll try merging again once another commit hits master, in case this was a fluke.

@brianschubert
Copy link
Collaborator

Even after installing python 3.9 I can't reproduce this. Odd.

FWIW, I can reproduce this locally in a fresh 3.9 venv:

$ python --version
Python 3.9.23
$ python -m mypy --config-file mypy_self_check.ini misc --exclude misc/sync-typeshed.py
misc/analyze_cache.py:44: error: Statement is unreachable  [unreachable]
                elif isinstance(chunk, list):
                ^
misc/analyze_cache.py:44: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info
misc/analyze_cache.py:96: error: Statement is unreachable  [unreachable]
                return chunk
                ^~~~~~~~~~~~
misc/analyze_cache.py:127: error: Statement is unreachable  [unreachable]
                return chunk
                ^~~~~~~~~~~~
Found 3 errors in 1 file (checked 17 source files)

I'll try merging again once another commit hits master, in case this was a fluke.

quick git tip: you can also tickle the CI by pushing an empty commit with git commit --allow-empty

Copy link
Contributor

github-actions bot commented Jun 9, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants