<s> """<STR_LIT>""" <EOL> import threading <EOL> import inspect <EOL> import ctypes <EOL> def _async_raise ( tid , exctype ) : <EOL> """<STR_LIT>""" <EOL> if not inspect . isclass ( exctype ) : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> res = ctypes . pythonapi . PyThreadState_SetAsyncExc ( tid , ctypes . py_object ( exctype ) ) <EOL> if res == <NUM_LIT:0> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> elif res != <NUM_LIT:1> : <EOL> ctypes . pythonapi . PyThreadState_SetAsyncExc ( tid , <NUM_LIT:0> ) <EOL> raise SystemError ( "<STR_LIT>" ) <EOL> class ThreadEx ( threading . Thread ) : <EOL> def _get_my_tid ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . isAlive ( ) : <EOL> raise threading . ThreadError ( "<STR_LIT>" ) <EOL> if hasattr ( self , "<STR_LIT>" ) : <EOL> return self . _thread_id <EOL> for tid , tobj in list ( threading . _active . items ( ) ) : <EOL> if tobj is self : <EOL> self . _thread_id = tid <EOL> return tid <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> def raise_exc ( self , exctype ) : <EOL> """<STR_LIT>""" <EOL> _async_raise ( self . _get_my_tid ( ) , exctype ) <EOL> def kill ( self ) : <EOL> """<STR_LIT>""" <EOL> self . raise_exc ( SystemExit ) </s>
