Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C API: Deprecate PyImport_ImportModuleNoBlock() function #105396

Closed
vstinner opened this issue Jun 6, 2023 · 1 comment
Closed

C API: Deprecate PyImport_ImportModuleNoBlock() function #105396

vstinner opened this issue Jun 6, 2023 · 1 comment
Labels
topic-C-API type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Jun 6, 2023

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.

Linked PRs

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label Jun 6, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jun 6, 2023
Deprecate the PyImport_ImportModuleNoBlock() function which is just
an alias to PyImport_ImportModule() since Python 3.3.
@vstinner
Copy link
Member Author

vstinner commented Jun 6, 2023

The PyImport_ImportModuleNoBlock() function is an alias to PyImport_ImportModule() since Python 3.3.

It's related to this main importlib change in Python 3.3: A Finer-Grained Import Lock

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.

vstinner added a commit that referenced this issue Jun 9, 2023
Deprecate the PyImport_ImportModuleNoBlock() function which is just
an alias to PyImport_ImportModule() since Python 3.3.
@vstinner vstinner closed this as completed Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-C-API type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants