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.
S
Sam Gross committed
857bdba0ac66ed7963e9fca45ab1a5f7a32b4bfb
Parent: 8207454
Committed by GitHub <noreply@github.com>
on 2/18/2025, 11:02:42 PM