Fix pypy semantic action bug in CALL_METHOD

This commit is contained in:
rocky
2016-08-14 22:59:34 -04:00
parent 0958dc889d
commit a65443ee02
3 changed files with 7 additions and 5 deletions

Binary file not shown.

View File

@@ -0,0 +1,4 @@
# Bug in PyPy was not hacndling 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

@@ -1730,8 +1730,7 @@ class SourceWalker(GenericASTTraversal, object):
%c, %C, and so on. %c, %C, and so on.
""" """
# self.println("-----") # self.println("----> ", startnode.type)
# self.print(startnode)
fmt = entry[0] fmt = entry[0]
arg = 1 arg = 1
@@ -1850,11 +1849,10 @@ class SourceWalker(GenericASTTraversal, object):
continue continue
op = k[ :k.rfind('_') ] op = k[ :k.rfind('_') ]
if k == 'CALL_METHOD': if k.startswith('CALL_METHOD'):
# This happens in PyPy only # This happens in PyPy only
TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100)) TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100))
elif op == 'CALL_FUNCTION':
if op == 'CALL_FUNCTION':
TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100)) TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100))
elif op in ('CALL_FUNCTION_VAR', elif op in ('CALL_FUNCTION_VAR',
'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'): 'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'):