You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fix "for ... if" bug introduced since 3.6.2...
However we've isolated and documented the 3.x grammar a little bit better
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# 101_0 COME_FROM '50' statement: if name == ...to fictional "end if"
|
||||
# 101 JUMP_BACK '16' jump as before to loop head
|
||||
|
||||
# RUNNABLE!
|
||||
def _slotnames(cls):
|
||||
names = []
|
||||
for c in cls.__mro__:
|
||||
@@ -21,3 +22,18 @@ def _slotnames(cls):
|
||||
continue
|
||||
else:
|
||||
names.append(name) # 3.2 bug here jumping to outer for
|
||||
|
||||
# From 3.2.6 pdb.py
|
||||
# There is no "come_from" after the "if" since the
|
||||
# if jumps back to the loop. For this we use
|
||||
# grammar rule "ifstmtl"
|
||||
def lasti2lineno(linestarts, a):
|
||||
for i in linestarts:
|
||||
if a:
|
||||
return a
|
||||
return -1
|
||||
|
||||
assert lasti2lineno([], True) == -1
|
||||
assert lasti2lineno([], False) == -1
|
||||
assert lasti2lineno([1], False) == -1
|
||||
assert lasti2lineno([1], True) == 1
|
||||
|
Reference in New Issue
Block a user