[issue17098] Set __loader__ on modules imported by the C level

Brett Cannon report at bugs.python.org
Fri Feb 1 19:47:58 CET 2013


Brett Cannon added the comment:

All cases but signal can be fixed by importlib._bootstrap._setup() by simply iterating over sys.modules and setting __loader__. Nice and simple. Thanks, abstraction!

The problem is signal who gives the finger to abstraction. That module gets imported directly by C code which cheats by calling PyInit_signal() directly and then calling _PyImport_FixupBuiltin(). I tried setting __loader__ in there but I'm actually triggering a segfault in PyErr_Format()! This is probably because I/O streams are not set up yet at this point in interpreter startup. Anyway, I'm trying to simply not have the code cheat and instead just import the signal module through the proper abstractions.

----------

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


More information about the Python-bugs-list mailing list