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

Open
wants to merge 1 commit into
base: main
Choose a base branch
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

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. (I'm on mobile si I can't link the issue right now but there's not much more information than what you also saw)

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.

2 participants