<s> """<STR_LIT>""" <EOL> from pypy . interpreter import function <EOL> from pypy . objspace . descroperation import object_getattribute <EOL> from pypy . rlib import rstack <EOL> def LOOKUP_METHOD ( f , nameindex , * ignored ) : <EOL> space = f . space <EOL> w_obj = f . popvalue ( ) <EOL> w_name = f . getname_w ( nameindex ) <EOL> w_value = None <EOL> if space . config . objspace . std . getattributeshortcut : <EOL> w_type = space . type ( w_obj ) <EOL> fastpath = w_type . uses_object_getattribute <EOL> else : <EOL> w_getattribute = space . lookup ( w_obj , '<STR_LIT>' ) <EOL> if w_getattribute is object_getattribute ( space ) : <EOL> w_type = space . type ( w_obj ) <EOL> fastpath = True <EOL> else : <EOL> fastpath = False <EOL> if fastpath : <EOL> name = space . str_w ( w_name ) <EOL> w_descr = w_type . lookup ( name ) <EOL> if w_descr is None : <EOL> w_value = w_obj . getdictvalue ( space , w_name ) <EOL> elif type ( w_descr ) is function . Function : <EOL> w_value = w_obj . getdictvalue_attr_is_in_class ( space , w_name ) <EOL> if w_value is None : <EOL> f . pushvalue ( w_descr ) <EOL> f . pushvalue ( w_obj ) <EOL> return <EOL> if w_value is None : <EOL> w_value = space . getattr ( w_obj , w_name ) <EOL> f . pushvalue ( w_value ) <EOL> f . pushvalue ( None ) <EOL> def CALL_METHOD ( f , nargs , * ignored ) : <EOL> w_self = f . peekvalue ( nargs ) <EOL> w_callable = f . peekvalue ( nargs + <NUM_LIT:1> ) <EOL> n = nargs + ( w_self is not None ) <EOL> try : <EOL> w_result = f . space . call_valuestack ( w_callable , n , f ) <EOL> rstack . resume_point ( "<STR_LIT>" , f , nargs , returns = w_result ) <EOL> finally : <EOL> f . dropvalues ( nargs + <NUM_LIT:2> ) <EOL> f . pushvalue ( w_result ) <EOL> def call_method_opt ( space , w_obj , methname , * arg_w ) : <EOL> """<STR_LIT>""" <EOL> w_name = space . wrap ( methname ) <EOL> w_getattribute = space . lookup ( w_obj , '<STR_LIT>' ) <EOL> if w_getattribute is object_getattribute ( space ) : <EOL> w_descr = space . lookup ( w_obj , methname ) <EOL> if type ( w_descr ) is function . Function : <EOL> w_value = w_obj . getdictvalue_attr_is_in_class ( space , w_name ) <EOL> if w_value is None : <EOL> return space . call_function ( w_descr , w_obj , * arg_w ) <EOL> w_meth = space . getattr ( w_obj , w_name ) <EOL> return space . call_function ( w_meth , * arg_w ) </s>
