[issue32973] Importing the same extension module under multiple names breaks non-reinitialisable extension modules
Stefan Behnel
report at bugs.python.org
Sat Aug 25 12:36:18 EDT 2018
Stefan Behnel <stefan_ml at behnel.de> added the comment:
FYI, I've updated Cython's module import checks to include an interpreter check. This (multi-file) test shows the new behaviour, which is to raise an ImportError on module creation when it detects a different interpreter than during the initial import:
https://github.com/cython/cython/blob/master/tests/run/reimport_from_subinterpreter.srctree
The checks are implemented here (and called a bit further down in the module create function):
https://github.com/cython/cython/blob/4ce754271ff4cfbd8df2b278e812154fb1b02319/Cython/Utility/ModuleSetupCode.c#L909-L932
I also added a test that should match the problem discussed here, which makes what I described appear as a viable solution (or work-around):
https://github.com/cython/cython/blob/master/tests/run/reimport_from_package.srctree
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32973>
_______________________________________
More information about the Python-bugs-list
mailing list