This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Trundle
Recipients Trundle, elias
Date 2011-03-28.23:44:56
SpamBayes Score 3.0544522e-10
Marked as misclassified No
Message-id <1301355897.48.0.255084082556.issue11705@psf.upfronthosting.co.za>
In-reply-to
Content
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):``).
History
Date User Action Args
2011-03-28 23:44:57Trundlesetrecipients: + Trundle, elias
2011-03-28 23:44:57Trundlesetmessageid: <1301355897.48.0.255084082556.issue11705@psf.upfronthosting.co.za>
2011-03-28 23:44:56Trundlelinkissue11705 messages
2011-03-28 23:44:56Trundlecreate