Skip to content

Commit 7fd21aa

Browse files
committed
Fix more Python 1.4 decompilation bugs
1 parent 82bc294 commit 7fd21aa

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

test/simple_source/bug14/01_print.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Python 1.4 aifc.py
2+
# Something weird about the final "print" and PRINT_NL_CONT followed by PRINT_NL
23
def _readmark(self, markers):
34
if self._markers: print 'marker',
45
else: print 'markers',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Python 1.4 cgi.py
2+
# Bug was in "continue" detection.
3+
# 1.4 doesn't have lnotab and our CONTINUE detection is off.
4+
def parse_multipart(params, pdict):
5+
while params:
6+
if params.has_key('name'):
7+
params = None
8+
else:
9+
continue
10+
11+
return None

uncompyle6/parsers/parse14.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def p_misc14(self, args):
2525
2626
print_items_nl_stmt ::= expr PRINT_ITEM_CONT print_items_opt PRINT_NEWLINE_CONT
2727
28+
29+
# 1.4 doesn't have linenotab, and although this shouldn't
30+
# be a show stopper, our CONTINUE detection is off here.
31+
continue ::= JUMP_BACK
2832
"""
2933

3034
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):

0 commit comments

Comments
 (0)