mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Close #24748: Restore imp.load_dynamic compatibility
To resolve a compatibility problem found with py2exe and pywin32, imp.load_dynamic() once again ignores previously loaded modules to support Python modules replacing themselves with extension modules. Patch by Petr Viktorin.
This commit is contained in:
parent
1b66910537
commit
9d3c61c86a
5 changed files with 49 additions and 1 deletions
|
@ -334,6 +334,12 @@ if create_dynamic:
|
|||
"""
|
||||
import importlib.machinery
|
||||
loader = importlib.machinery.ExtensionFileLoader(name, path)
|
||||
return loader.load_module()
|
||||
|
||||
# Issue #24748: Skip the sys.modules check in _load_module_shim;
|
||||
# always load new extension
|
||||
spec = importlib.machinery.ModuleSpec(
|
||||
name=name, loader=loader, origin=path)
|
||||
return _load(spec)
|
||||
|
||||
else:
|
||||
load_dynamic = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue