-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Multi-phase module initialisation (PEP 489) #1715
Comments
Implemented in #1794 |
Reopening since the implementation in 0.27.0 is not complete and was disabled in 0.27.1. It requires proper reloading support, which is not trivial. |
The implementation in the latest master branch should be safer now. It does not allow module reloading nor does it support subinterpreters. In fact, it detects subinterpreters and prevents a reload in a different one than the first import. A reload in the same interpreter simply returns the existing module. |
CPython 3.5 introduced a new module initialisation scheme in multiple phases:
https://www.python.org/dev/peps/pep-0489/
This improves the support for extension module reloading and could also allow running extension modules as main module (
python -m
) in the future (probably Py3.7).Worth implementing. It requires splitting up the
generate_module_init_func()
method in https://github.com/cython/cython/blob/master/Cython/Compiler/ModuleNode.py to generate separate functions for the separate phases, and then also to find a compatible fallback way to execute them in older Python versions.The proposed CPython support for runnable extension modules is tracked here: https://bugs.python.org/issue30403
The text was updated successfully, but these errors were encountered: