You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Small pypy LOOKUP_METHOD cleanups
This commit is contained in:
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user