mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
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.
This commit is contained in:
parent
8207454bc0
commit
857bdba0ac
2 changed files with 14 additions and 3 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix two race conditions involving concurrent imports that could lead to
|
||||
spurious failures with :exc:`ModuleNotFoundError`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue