-
-
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
Another attempt at fixing the collections.abc
issue for Python 3.13
#2665
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2665 +/- ##
==========================================
- Coverage 93.21% 93.19% -0.02%
==========================================
Files 93 93
Lines 11083 11088 +5
==========================================
+ Hits 10331 10334 +3
- Misses 752 754 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f3e472f
to
0a5c16b
Compare
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.
In 3.3.6, the django submodule wasn't imported, but even with this PR it's still being imported.
(Also major 🙏 🙏 for devoting debugging time to this, much appreciated!)
But on |
Never mind, of course on I have pushed another change, let's see if this works. First default to the normal behaviour, after it, try and see if we can frozen modules. |
8584096
to
50916d6
Compare
collections
collections.abc
issue for Python 3.13
Thanks. Once we have a clean pylint run, let's rebase on main and follow the usual process. Around new year I was planning to cut an alpha of astroid and bring pylint up to date, sorry it hasn't happened yet. We already have a contributor who's ready to merge in the test fixes. |
The clean run is going now :) I'm not sure what the usual process would be here? Can't we merge this into the maintenance branch and then resolve any issues we get with merging it into |
astroid/interpreter/_import/spec.py
Outdated
# `find_spec` raises a ValueError for modules that are missing their `__spec__` | ||
# attributes. We don't really understand why, but this is likely caused by | ||
# us re-implementing the import behaviour but not correctly. |
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.
Let's not make this sound mysterious: I thought it was just namespace modules (or maybe pypy) that sometimes do this, and it's good that we're catching the documented exception.
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.
I really have no clue. The only reason I know that we need to catch this is because it was part of the stack of the original issue reporter. I still don't really know how to reproduce this case.
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.
That's fine, but let's just remove the comment. The function is documented to raise ValueError, so let's just catch it without a comment.
spec = importlib.util.find_spec(".".join((*processed, modname))) | ||
try: | ||
with warnings.catch_warnings(): | ||
warnings.filterwarnings("ignore", category=Warning) |
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.
What do you think about limiting this to UserWarning for parity with #2121?
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.
I ran into issues with DeprecationWarnings
for lib2to3
in the stdlib
primer for pylint
which is why I had to bump this to Warning
.
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.
Alright. It seems like a little bit of a regression that we're importing stdlib modules in more cases now, but I guess we have no choice really.
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.
Yeah.. I really don't know of any other way to fix this.
My thought was: |
It now targets Considering I won't have any time during Christmas I'd personally prefer to target this on the maintenance branch and just get the fix out. |
Co-authored-by: Jacob Walls <[email protected]>
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.
Thanks for giving me a little time to grok this, and thanks for such a diligent follow-up. Happy new year!
(will reapprove after merge conflicts spruced up) |
astroid/interpreter/_import/spec.py
Outdated
for suffix, type_ in ImportlibFinder._SUFFIXES: | ||
file_name = modname + suffix | ||
file_path = os.path.join(entry, file_name) | ||
if cached_os_path_isfile(file_path): |
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.
@jacobtylerwalls Bit afraid of this change... The 3.3.x
branch doesn't have it so I'm not sure if this introduce more issues.
But if you approve I guess we can just try to make it work.
for more information, see https://pre-commit.ci
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.
Good to know, that will help me resolve the merge conflict on the backport.
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-2665-to-maintenance/3.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f94e855268895bf995fe8eb258ea7ff7d7ccd9cf
# Push it to GitHub
git push --set-upstream origin backport-2665-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 |
…pylint-dev#2665) * Fix issue with importing of frozen submodules (cherry picked from commit f94e855)
…ns.abc` issue for Python 3.13 (#2665) (#2666) * Fix issue with importing of frozen submodules (cherry picked from commit f94e855) * Test on Python 3.13 final * Bump CI jobs to python 3.13 --------- Co-authored-by: Daniël van Noord <[email protected]>
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.
Thanks a lot for handling this Daniel, amazing !
Well, #2658 did not work.
Let's try to fix pylint-dev/pylint#10112 again with a new fix.
It is basically the same fix as last time, but this time with some more
try ... except
and changing the order around. First do the normal logic, then try the frozen module logic.Note that this targets the
3.3.x
branch as I couldn't get the CI ofpylint
to pass from the4.x
branch. Since this needs to be back ported anyway I think that is fine.