[issue16392] import crashes on circular imports in ext modules

Stefan Behnel report at bugs.python.org
Sun Nov 4 09:30:46 CET 2012


Stefan Behnel added the comment:

The problem is a) that the module does not necessarily know to which place it eventually gets installed (Cython relies on the distutils Extension not lying to it, for example, which people do from time to time), and b) that the call to Py_InitModule() only receives the plain module name, not the package path. And yes, as mentioned in the other issue, passing a pointer to a context description struct into the module init function would have been the right thing to change for Py3 and still is the right thing to change for Py4.

BTW, I can confirm that registering the module in sys.modules explicitly right after creation works around this issue. Given that Cython needs to know the FQMN at compile time anyway, this works for us. It still leaves the problem open for other extension code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16392>
_______________________________________


More information about the Python-bugs-list mailing list