Skip to content

[3.13] gh-130094: Fix race conditions in importlib (gh-130101) - #155915

Merged
corona10 merged 1 commit into
python:3.13from
zsaladin:backport-857bdba-3.13
Aug 17, 2026
Merged

[3.13] gh-130094: Fix race conditions in importlib (gh-130101)#155915
corona10 merged 1 commit into
python:3.13from
zsaladin:backport-857bdba-3.13

Conversation

@zsaladin

@zsaladin zsaladin commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Entries may be added or removed from sys.meta_path concurrently. For example, setuptools temporarily adds and removes the distutils finder from the beginning of the list. The local copy ensures that we don't skip over any entries.

Some packages modify sys.modules during import. For example, collections inserts the entry for collections.abc into sys.modules during import. We need to ensure that we re-check sys.modules after the parent module is fully initialized.
(cherry picked from commit 857bdba)

@zsaladin

zsaladin commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@hugovk I made a PR! Thank you for your help!

…130101)

Entries may be added or removed from `sys.meta_path` concurrently. For
example, setuptools temporarily adds and removes the `distutils` finder from
the beginning of the list. The local copy ensures that we don't skip over any
entries.

Some packages modify `sys.modules` during import. For example, `collections`
inserts the entry for `collections.abc`  into `sys.modules` during import. We
need to ensure that we re-check `sys.modules` *after* the parent module is
fully initialized.
(cherry picked from commit 857bdba)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@zsaladin
zsaladin force-pushed the backport-857bdba-3.13 branch from 67c0bf0 to f45ca68 Compare August 17, 2026 02:15

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🎉

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint Aug 17, 2026
@corona10
corona10 merged commit b0a181d into python:3.13 Aug 17, 2026
45 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants