Skip to content
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 import error #2656

Closed
wants to merge 1 commit into from

Conversation

zenlyj
Copy link

@zenlyj zenlyj commented Dec 12, 2024

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
πŸ”¨ Refactoring
πŸ“œ Docs

Description

I was looking into the recent collections.abc import error with Python 3.13.1 and wanted to share my findings, regardless of whether this gets merged or not. Hopefully this helps in some way.

Did some testing locally with Linux environment and noticed the following:

  • In 3.12.8, collections.abc is not a frozen module and origin is at /usr/lib/python3.12/collections/abc.py
  • In 3.13.1, collections.abc is a frozen module

image

Now in the spec._find_spec, it is searching in the following submodule_path - /usr/lib/python3.13/collections, and giving error when not found. However, we expect it to be unfound as it is a frozen module.

There is already existing logic for handling frozen modules in the ImportlibFinder class, so perhaps we can utilize that?

Closes #XXXX

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Dec 12, 2024

Thank you for the investigation. Jacob tried to add an astroid brain for collections.abc in astroid 3.3.6 but it's not used during import for reasons I don't understand yet. pylint-dev/pylint#10112

KKoukiou added a commit to KKoukiou/anaconda that referenced this pull request Dec 16, 2024
python-3.13.1 broke compatibility with pylint.

Revert this one the pylint issue [1] is fixed.

[1] pylint-dev/pylint#10112
[2] pylint-dev/astroid#2656
rvykydal pushed a commit to rvykydal/anaconda that referenced this pull request Dec 17, 2024
python-3.13.1 broke compatibility with pylint.

Revert this one the pylint issue [1] is fixed.

[1] pylint-dev/pylint#10112
[2] pylint-dev/astroid#2656
@DanielNoord
Copy link
Collaborator

Superseded by #2657. Thanks for taking a stab at this, you correctly identified this as being an issue with our checks for submodules.

@zenlyj zenlyj deleted the fix/import-error-abc branch December 19, 2024 11:39
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