[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

Xiang Zhang report at bugs.python.org
Wed Aug 17 13:50:03 EDT 2016


Xiang Zhang added the comment:

Thanks Petr. I'd appreciate it if you are willing to review the patch.

Upload a patch to fix this, along with tests and doc updating.

But here is something different. In PEP489, it is explicitly stated that "Py_mod_create slot is not responsible for setting import-related attributes specified in PEP 451 (such as __name__ or __loader__ ) on the new module". So when an object(even ModuleType instances) is returned, it's __name__ attribute is not set and we can't rely on it (which means we can't even use PyModule_GetNameObject). I then use the name attribute of the spec. Looking forward to feedback.

----------
keywords: +patch
Added file: http://bugs.python.org/file44136/issue27782.patch

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


More information about the Python-bugs-list mailing list