<s> import sys <EOL> import threading <EOL> def install_thread_sys_excepthook ( ) : <EOL> "<STR_LIT>" <EOL> if hasattr ( threading , '<STR_LIT>' ) : <EOL> return <EOL> threading . __sys_excepthook_reinstalled__ = True <EOL> init_old = threading . Thread . __init__ <EOL> def init ( self , * args , ** kwargs ) : <EOL> init_old ( self , * args , ** kwargs ) <EOL> run_old = self . run <EOL> def run_with_except_hook ( * args , ** kw ) : <EOL> try : <EOL> run_old ( * args , ** kw ) <EOL> except ( KeyboardInterrupt , SystemExit ) : <EOL> raise <EOL> except : <EOL> sys . excepthook ( * sys . exc_info ( ) ) <EOL> self . run = run_with_except_hook <EOL> threading . Thread . __init__ = init </s>
