Commit 22eef3dc authored by Stefan Behnel's avatar Stefan Behnel

Enable PEP-489 multi-phase module initialisation, now that re-imports are handled with an error.

parent 8ebe2727
...@@ -8,6 +8,9 @@ Cython Changelog ...@@ -8,6 +8,9 @@ Cython Changelog
Features added Features added
-------------- --------------
* PEP-489 multi-phase module initialisation has been enabled again. Module
reloads raise an exception to prevent corruption of the static module state.
* Raising exceptions from nogil code will automatically acquire the GIL, instead * Raising exceptions from nogil code will automatically acquire the GIL, instead
of requiring an explicit ``with gil`` block. of requiring an explicit ``with gil`` block.
......
...@@ -178,9 +178,7 @@ ...@@ -178,9 +178,7 @@
#define CYTHON_FAST_PYCALL 1 #define CYTHON_FAST_PYCALL 1
#endif #endif
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
// Disabled for now. Most extension modules simply can't deal with it, and Cython isn't ready either. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
// See issues listed here: https://docs.python.org/3/c-api/init.html#sub-interpreter-support
#define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
#endif #endif
#ifndef CYTHON_USE_TP_FINALIZE #ifndef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
......
...@@ -33,9 +33,8 @@ import atest.package.module as module ...@@ -33,9 +33,8 @@ import atest.package.module as module
assert module in sys.modules.values(), list(sys.modules) assert module in sys.modules.values(), list(sys.modules)
assert sys.modules['atest.package.module'] is module, list(sys.modules) assert sys.modules['atest.package.module'] is module, list(sys.modules)
# TODO: re-enable with PEP-489 support if sys.version_info >= (3, 5):
#if sys.version_info >= (3, 5): from . import pymodule
# from . import pymodule
######## atest/package/pymodule.py ######## ######## atest/package/pymodule.py ########
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment