Message91244
Instead of using decorators, this is a slightly simpler modification to
the proposed workaround that allows for any subclassed run method to
also be caught.
def installThreadExcepthook():
"""
Workaround for sys.excepthook thread bug
From
http://spyced.blogspot.com/2007/06/workaround-for-sysexcepthook-bug.html
(https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1230540&group_id=5470).
Call once from __main__ before creating any threads.
If using psyco, call psyco.cannotcompile(threading.Thread.run)
since this replaces a new-style class method.
"""
init_old = threading.Thread.__init__
def init(self, *args, **kwargs):
init_old(self, *args, **kwargs)
run_old = self.run
def run_with_except_hook(*args, **kw):
try:
run_old(*args, **kw)
except (KeyboardInterrupt, SystemExit):
raise
except:
sys.excepthook(*sys.exc_info())
self.run = run_with_except_hook
threading.Thread.__init__ = init |
|
Date |
User |
Action |
Args |
2009-08-03 22:24:05 | undercoveridiot | set | recipients:
+ undercoveridiot, mwh, ellisj, tiagoaoa |
2009-08-03 22:24:05 | undercoveridiot | set | messageid: <1249338245.17.0.425430573854.issue1230540@psf.upfronthosting.co.za> |
2009-08-03 22:24:03 | undercoveridiot | link | issue1230540 messages |
2009-08-03 22:24:03 | undercoveridiot | create | |
|