<s> """<STR_LIT>""" <EOL> from pypy . interpreter . error import OperationError <EOL> from pypy . interpreter . gateway import ObjSpace <EOL> from pypy . rlib . runicode import MAXUNICODE <EOL> import sys <EOL> def setbuiltinmodule ( w_module , name ) : <EOL> """<STR_LIT>""" <EOL> if builtin_modules [ name ] is None : <EOL> builtin_modules [ name ] = space . unwrap ( w_module ) <EOL> else : <EOL> assert builtin_modules [ name ] is space . unwrap ( w_module ) , ( <EOL> "<STR_LIT>" % ( name , ) ) <EOL> space . setitem ( w_modules , space . wrap ( name ) , w_module ) <EOL> def _getframe ( space , w_depth = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> depth = space . int_w ( w_depth ) <EOL> if depth < <NUM_LIT:0> : <EOL> raise OperationError ( space . w_ValueError , <EOL> space . wrap ( "<STR_LIT>" ) ) <EOL> ec = space . getexecutioncontext ( ) <EOL> f = ec . gettopframe_nohidden ( ) <EOL> f . force_f_back ( ) <EOL> while True : <EOL> if f is None : <EOL> raise OperationError ( space . w_ValueError , <EOL> space . wrap ( "<STR_LIT>" ) ) <EOL> if depth == <NUM_LIT:0> : <EOL> break <EOL> depth -= <NUM_LIT:1> <EOL> f = ec . getnextframe_nohidden ( f ) <EOL> return space . wrap ( f ) <EOL> def setrecursionlimit ( space , w_new_limit ) : <EOL> """<STR_LIT>""" <EOL> new_limit = space . int_w ( w_new_limit ) <EOL> if new_limit <= <NUM_LIT:0> : <EOL> raise OperationError ( space . w_ValueError , <EOL> space . wrap ( "<STR_LIT>" ) ) <EOL> space . sys . recursionlimit = new_limit <EOL> def getrecursionlimit ( space ) : <EOL> """<STR_LIT>""" <EOL> return space . wrap ( space . sys . recursionlimit ) <EOL> def setcheckinterval ( space , interval ) : <EOL> """<STR_LIT>""" <EOL> space . actionflag . setcheckinterval ( space , interval ) <EOL> setcheckinterval . unwrap_spec = [ ObjSpace , int ] <EOL> def getcheckinterval ( space ) : <EOL> """<STR_LIT>""" <EOL> result = space . sys . checkinterval <EOL> if result <= <NUM_LIT:1> : <EOL> result = <NUM_LIT:0> <EOL> return space . wrap ( result ) <EOL> def exc_info ( space ) : <EOL> """<STR_LIT>""" <EOL> operror = space . getexecutioncontext ( ) . sys_exc_info ( ) <EOL> if operror is None : <EOL> return space . newtuple ( [ space . w_None , space . w_None , space . w_None ] ) <EOL> else : <EOL> return space . newtuple ( [ operror . w_type , operror . w_value , <EOL> space . wrap ( operror . application_traceback ) ] ) <EOL> def exc_clear ( space ) : <EOL> """<STR_LIT>""" <EOL> operror = space . getexecutioncontext ( ) . sys_exc_info ( ) <EOL> if operror is not None : <EOL> operror . clear ( space ) <EOL> def settrace ( space , w_func ) : <EOL> """<STR_LIT>""" <EOL> space . getexecutioncontext ( ) . settrace ( w_func ) <EOL> def setprofile ( space , w_func ) : <EOL> """<STR_LIT>""" <EOL> space . getexecutioncontext ( ) . setprofile ( w_func ) <EOL> def call_tracing ( space , w_func , w_args ) : <EOL> """<STR_LIT>""" <EOL> return space . getexecutioncontext ( ) . call_tracing ( w_func , w_args ) </s>
