[3.13] gh-130094: Fix race conditions in `importlib` (gh-130101) · python/cpython@67c0bf0 · GitHub
Skip to content

Commit 67c0bf0

Browse files
colesbury김대희[ AIB Model 2 ]
authored andcommitted
[3.13] gh-130094: Fix race conditions in importlib (gh-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>
1 parent 448f259 commit 67c0bf0

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎Lib/importlib/_bootstrap.py‎

Lines changed: 12 additions & 3 deletions
Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)