-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix collections.abc
imports on Python 3.13.0 and 3.13.1
#2657
Fix collections.abc
imports on Python 3.13.0 and 3.13.1
#2657
Conversation
Nice 😌, I was running in circle with this bug ! (I don't have time for a full review atm, but should we temporarily test in CI for python 3.13.0 and 3.13.1 ?) I can do the releases, sure. |
I'm 100% sure this fixes the issue for As for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great !
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@Pierre-Sassoulas could you reapprove and merge? :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2657 +/- ##
==========================================
+ Coverage 93.19% 93.21% +0.02%
==========================================
Files 93 93
Lines 11078 11083 +5
==========================================
+ Hits 10324 10331 +7
+ Misses 754 752 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/3.3.x maintenance/3.3.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/3.3.x
# Create a new branch
git switch --create backport-2657-to-maintenance/3.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 631a76cbdec372481397c000b9883d219c6f8ae1
# Push it to GitHub
git push --set-upstream origin backport-2657-to-maintenance/3.3.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/3.3.x Then, create a pull request where the |
Working on the manual cherry-pick atm. |
* Add test for importing `collections.abc` * Fix issue with importing of frozen submodules
The cherry-pick is hard, maybe we can release 3.4.0 directly ? |
I can help with the cherry-pick over the weekend if need be. |
) * Fix `collections.abc` imports on Python 3.13.0 and 3.13.1 (#2657) * Add test for importing `collections.abc` * Fix issue with importing of frozen submodules * Fix `search_paths` * Do not reassign submodule_path parameters in method bodies This makes it easier to use less generic annotations with mypy. --------- Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Co-authored-by: correctmost <134317971+correctmost@users.noreply.github.com>
Supersedes #2656
References pylint-dev/pylint#10112
Reverts and improves on #2647
Is likely related to python/cpython#125415
The issue was partially identified in #2656 but not fixed correctly there I think.
The issue
3.13.1
introduces is that submodules of stdlib modules can now also be frozen and even change their name. This is somewhat annoying, but fixable.However, while debugging I noticed that
find_spec
is actually pretty dangerous to call. It imports the full module and can therefore raisewarnings
etc.In this PR I take a different approach. Only if we know we're dealing with a stdlib module or stdlib submodule we try and retrieve the
frozen
module. Otherwise, don't import the module as that is just costly for no additional gain.The issue with that approach is that it only works on Python 3.10+. To work around this I just copied to old code to an
else
branch that is only executed on3.9
and below. This is fine as these versions don't deal with submodules being frozen.As can be seen from the test runs the tests does serve as a regression. It fails on
main
, but passes with the fixes in this PR.The PyPy failure is unrelated. The checks job won't pass until
pylint
itself is fixed.There was also already a Changelog entry for
3.3.7
, but I just reused that. I think a rebase went wrong there.I tested this locally against
3.13.0
and3.13.1
. I did see some failures onpylint
but my local setup is very broken currently so I can't really determine whether it is related to this PR. Anyhow, I think this fix by itself is worth merging as it clearly fixes a test that should pass. We can worry aboutpylint
later.Lastly, @Pierre-Sassoulas @jacobtylerwalls I know I won't have time for a release of
astroid
andpylint
in the coming days/weeks. If you approve the PR would you mind doing the release? I can answer questions, but my time off ends today so I need to get back to $work.