Small pypy LOOKUP_METHOD cleanups

This commit is contained in:
rocky
2016-08-16 06:09:10 -04:00
parent 85c562cb36
commit 2e3e6658ee
3 changed files with 6 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
# Bug in PyPy was not hacndling CALL_METHOD_xxx like
# Bug in PyPy was not handling CALL_METHOD_xxx like
# CALL_FUNCTION_XXX
def truncate(self, size=None):
self.db.put(self.key, '', txn=self.txn, dlen=self.len - size, doff=size)

View File

@@ -409,7 +409,7 @@ class Python2Parser(PythonParser):
+ 'expr ' * nak + opname
elif opname_base == 'CALL_METHOD':
# PyPy only - DRY with parse3
args_pos = (v & 0xff) # positional parameters
args_pos = (v & 0xff) # positional parameters
args_kw = (v >> 8) & 0xff # keyword parameters
# number of apply equiv arguments:
nak = ( len(opname_base)-len('CALL_METHOD') ) // 3

View File

@@ -581,14 +581,17 @@ class Python3Parser(PythonParser):
self.add_unique_rule(rule, opname, token.attr, customize)
elif opname_base == 'CALL_METHOD':
# PyPy only - DRY with parse2
# FIXME: The below argument parsing will be wrong when PyPy gets to 3.6
args_pos = (token.attr & 0xff) # positional parameters
args_kw = (token.attr >> 8) & 0xff # keyword parameters
# number of apply equiv arguments:
nak = ( len(opname_base)-len('CALL_METHOD') ) // 3
rule = ('call_function ::= expr '
+ ('pos_arg ' * args_pos)
+ ('kwarg ' * args_kw)
+ 'expr ' * nak + token.type)
+ 'expr ' * nak + opname)
self.add_unique_rule(rule, opname, token.attr, customize)
elif opname.startswith('MAKE_CLOSURE'):
# DRY with MAKE_FUNCTION