Skip to content

Remove redundant version_info branches #14434

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

Merged
merged 1 commit into from
Jul 20, 2025
Merged

Conversation

AlexWaygood
Copy link
Member

This whole module is inside an if sys.version_info >= (3, 11) check from line 7 to the bottom of the file, so it's unnecessary to do additional sys.version_info >= (3, 10) or sys.version_info >= (3, 11) checks lower down. The else branches are just dead code.

@brianschubert
Copy link
Member

I see that stdlib/VERSIONS has the line importlib.resources.abc: 3.11-. Does that make the whole-module if sys.version_info >= (3, 11) check redundant?

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood
Copy link
Member Author

I see that stdlib/VERSIONS has the line importlib.resources.abc: 3.11-. Does that make the whole-module if sys.version_info >= (3, 11) check redundant?

I think pyright checks the module in our CI anyway for the Python <3.11 versions in our CI matrix, despite the fact that it would not actually use the stub if it were checking third-party code on Python <3.11. Good question though!

@AlexWaygood AlexWaygood marked this pull request as ready for review July 20, 2025 22:56
@AlexWaygood AlexWaygood merged commit ae1b471 into main Jul 20, 2025
64 checks passed
@AlexWaygood AlexWaygood deleted the version-info-branches branch July 20, 2025 22:56
@brianschubert
Copy link
Member

I think pyright checks the module in our CI anyway for the Python <3.11 versions in our CI matrix

Thanks, this helped me realize why pyright was having issues with #14307 (comment) for Python <3.13 :-)

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