Message132445
I really doubt that this issue has anything to do with `sys.excepthook` at all. It's rather that module members are set to `None` during module cleanup. Because the module raises an exception when one tries to import it, it will be cleaned up immediately (see `PyImport_ExecCodeModuleEx`: it calls `remove_module` which will call at some point `_PyModule_Clear`). At the time when `sys.excepthook` is called, all module members are already set to `None`.
One can easily demonstrate that this is really the problem by removing the exception raise in your example code: If one then imports "loggingTest" in an interactive session and raises an exception, the expected behaviour can be observed.
Another workaround is to bind `logger` as a default argument (i.e. ``def handleException(excType, excValue, traceback, logger=logger):``). |
|
Date |
User |
Action |
Args |
2011-03-28 23:44:57 | Trundle | set | recipients:
+ Trundle, elias |
2011-03-28 23:44:57 | Trundle | set | messageid: <1301355897.48.0.255084082556.issue11705@psf.upfronthosting.co.za> |
2011-03-28 23:44:56 | Trundle | link | issue11705 messages |
2011-03-28 23:44:56 | Trundle | create | |
|