Message258586
PyImport_GetModuleDict: no module dictionary! can be raised during interpreter shutdown if a `__del__` method results in a warning. This only happens on Python 3.5.
The prompting case is IPython 4.0.2 and traitlets 4.1.0. An IPython ExtensionManager calls `self.shell.on_trait_change` during its `__del__` to unregister a listener. That `on_trait_change` method is deprecated, and tries to display a DeprecationWarning. The call to `warnings.warn results in:
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
There appear to be races involved, because the crash happens with inconsistent frequency, sometimes quite rarely.
I've tried to put together a simple minimal test case, but I cannot reproduce the crash outside of IPython. I can, however, reproduce inconsistent behavior where a UserWarning displayed during `__del__` sometimes fails with
ImportError: import of 'linecache' halted; None in sys.modules
and sometimes the exact same code succeeds, showing the error:
~/dev/tmp/del-warn/a.py:9: DeprecationWarning: I don't cleanup anymore
self.b.cleanup()
and sometimes it shows the warning but not the frame
~/dev/tmp/del-warn/a.py:9: DeprecationWarning: I don't cleanup anymore |
|
Date |
User |
Action |
Args |
2016-01-19 12:14:30 | minrk | set | recipients:
+ minrk |
2016-01-19 12:14:30 | minrk | set | messageid: <1453205670.9.0.210259286868.issue26153@psf.upfronthosting.co.za> |
2016-01-19 12:14:30 | minrk | link | issue26153 messages |
2016-01-19 12:14:30 | minrk | create | |
|