X Tutup
Skip to content

Commit a65443e

Browse files
committed
Fix pypy semantic action bug in CALL_METHOD
1 parent 0958dc8 commit a65443e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed
362 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Bug in PyPy was not hacndling CALL_METHOD_xxx like
2+
# CALL_FUNCTION_XXX
3+
def truncate(self, size=None):
4+
self.db.put(self.key, '', txn=self.txn, dlen=self.len - size, doff=size)

uncompyle6/semantics/pysource.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,7 @@ def engine(self, entry, startnode):
17301730
%c, %C, and so on.
17311731
"""
17321732

1733-
# self.println("-----")
1734-
# self.print(startnode)
1733+
# self.println("----> ", startnode.type)
17351734

17361735
fmt = entry[0]
17371736
arg = 1
@@ -1850,11 +1849,10 @@ def customize(self, customize):
18501849
continue
18511850
op = k[ :k.rfind('_') ]
18521851

1853-
if k == 'CALL_METHOD':
1852+
if k.startswith('CALL_METHOD'):
18541853
# This happens in PyPy only
18551854
TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100))
1856-
1857-
if op == 'CALL_FUNCTION':
1855+
elif op == 'CALL_FUNCTION':
18581856
TABLE_R[k] = ('%c(%P)', 0, (1, -1, ', ', 100))
18591857
elif op in ('CALL_FUNCTION_VAR',
18601858
'CALL_FUNCTION_VAR_KW', 'CALL_FUNCTION_KW'):

0 commit comments

Comments
 (0)
X Tutup