X Tutup
Skip to content

Commit 7a27036

Browse files
committed
Fix up looping by reinstating JUMP_ABSOLUTE -> JUMP_BACK or CONTINUE
get jump offsets into jump attributes. Fix up 3.2 scanner paritally and use that in 3.4 for in cross version disassembly.
1 parent fe9c8d5 commit 7a27036

File tree

13 files changed

+108
-79
lines changed

13 files changed

+108
-79
lines changed
202 Bytes
Binary file not shown.

test/simple_source/exception/05_try_except.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ def handle(module):
55
module = exc
66
return module
77

8+
def handle2(module):
9+
if module == 'foo':
10+
try:
11+
module = 1
12+
except ImportError as exc:
13+
module = exc
14+
return module
15+
816
try:
917
pass
1018
except ImportError as exc:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
while __name__ != '__main__':
2+
b = 4

test/simple_source/looping/while.py

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if __name__:
2+
for i in (1,2):
3+
x = 3
4+
pass
5+
pass

uncompyle6/parsers/parse2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,15 @@ def p_grammar(self, args):
405405
406406
407407
trystmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
408-
try_middle COME_FROM
408+
try_middle COME_FROM
409409
410410
# this is nested inside a trystmt
411411
tryfinallystmt ::= SETUP_FINALLY suite_stmts
412412
POP_BLOCK LOAD_CONST
413413
COME_FROM suite_stmts_opt END_FINALLY
414414
415-
tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
416-
try_middle else_suite COME_FROM
415+
tryelsestmt ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
416+
try_middle else_suite COME_FROM
417417
418418
tryelsestmtc ::= SETUP_EXCEPT suite_stmts_opt POP_BLOCK
419419
try_middle else_suitec COME_FROM

0 commit comments

Comments
 (0)
X Tutup