<s> import gevent <EOL> switched_to = [ False , False ] <EOL> def runner ( i ) : <EOL> switched_to [ i ] = True <EOL> def check ( g , g2 ) : <EOL> gevent . joinall ( ( g , g2 ) ) <EOL> assert switched_to == [ False , False ] , switched_to <EOL> assert isinstance ( g . value , gevent . GreenletExit ) <EOL> assert isinstance ( g2 . value , gevent . GreenletExit ) <EOL> assert g . _exc_info == ( None , None , None ) <EOL> assert g2 . _exc_info == ( None , None , None ) <EOL> assert g . _exc_info is not type ( g ) . _exc_info <EOL> assert g2 . _exc_info is not type ( g2 ) . _exc_info <EOL> switched_to [ : ] = [ False , False ] <EOL> g = gevent . spawn ( runner , <NUM_LIT:0> ) <EOL> g2 = gevent . spawn ( runner , <NUM_LIT:1> ) <EOL> gevent . kill ( g ) <EOL> gevent . kill ( g2 ) <EOL> check ( g , g2 ) <EOL> g = gevent . spawn ( runner , <NUM_LIT:0> ) <EOL> g2 = gevent . spawn ( runner , <NUM_LIT:1> ) <EOL> g . kill ( ) <EOL> g2 . kill ( ) <EOL> check ( g , g2 ) <EOL> g = gevent . spawn ( runner , <NUM_LIT:0> ) <EOL> g2 = gevent . spawn ( runner , <NUM_LIT:1> ) <EOL> g . throw ( gevent . GreenletExit ) <EOL> g2 . throw ( gevent . GreenletExit ) <EOL> check ( g , g2 ) <EOL> class MyException ( Exception ) : <EOL> pass <EOL> def catcher ( ) : <EOL> try : <EOL> while True : <EOL> gevent . sleep ( <NUM_LIT:0> ) <EOL> except Exception as e : <EOL> switched_to [ <NUM_LIT:0> ] = e <EOL> g = gevent . spawn ( catcher ) <EOL> g . start ( ) <EOL> gevent . sleep ( ) <EOL> gevent . kill ( g , MyException ( ) ) <EOL> gevent . sleep ( ) <EOL> assert isinstance ( switched_to [ <NUM_LIT:0> ] , MyException ) , switched_to </s>
