MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / install_thread_excepthook

Function install_thread_excepthook

runserver.py:62–80  ·  view source on GitHub ↗

Workaround for sys.excepthook thread bug (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 psycho.cannotcompile(threading.Thread.run) since this replaces a new-style cla

()

Source from the content-addressed store, hash-verified

60
61# Patch to make exceptions in threads cause an exception.
62def install_thread_excepthook():
63 """
64 Workaround for sys.excepthook thread bug
65 (https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1230540&group_id=5470).
66 Call once from __main__ before creating any threads.
67 If using psyco, call psycho.cannotcompile(threading.Thread.run)
68 since this replaces a new-style class method.
69 """
70 import sys
71 run_old = Thread.run
72
73 def run(*args, **kwargs):
74 try:
75 run_old(*args, **kwargs)
76 except (KeyboardInterrupt, SystemExit):
77 raise
78 except:
79 sys.excepthook(*sys.exc_info())
80 Thread.run = run
81
82
83# Exception handler will log unhandled exceptions

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected