You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C API: Deprecate PyImport_ImportModuleNoBlock() function #105396
The PyImport_ImportModuleNoBlock() function is an alias to PyImport_ImportModule() since Python 3.3. I propose to deprecate it and schedule its removal in Python 3.15.
Previous versions of CPython have always relied on a global import lock. This led to unexpected annoyances, such as deadlocks when importing a module would trigger code execution in a different thread as a side-effect. Clumsy workarounds were sometimes employed, such as the PyImport_ImportModuleNoBlock() C API function.
I propose to deprecate it and schedule its removal in Python 3.15.
Since the function is part of the stable ABI, it has to stay at the ABI level, but will be removed from the C API level.
Activity
pythongh-105396: Deprecate PyImport_ImportModuleNoBlock() function
vstinner commentedon Jun 6, 2023
It's related to this main importlib change in Python 3.3: A Finer-Grained Import Lock
Since the function is part of the stable ABI, it has to stay at the ABI level, but will be removed from the C API level.
gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)
Replace PyImport_ImportModuleNoBlock with PyImport_ImportModule.
Replace PyImport_ImportModuleNoBlock with PyImport_ImportModule.