mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 02:03:56 +00:00
More bugs found via sre_parse.py decompilation
This commit is contained in:
parent
fd36c77d2d
commit
28ef04d141
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,7 +9,8 @@ def readline (self):
|
||||
return
|
||||
|
||||
# From 2.4.6 sre.py
|
||||
# Bug in 2.4 and 2.3 was parsing the nested "while 1" with a "break" in it
|
||||
# Bug has to do with "break" not being recognized
|
||||
# and is a JUMP_FORWARD.
|
||||
def _parse(a, b, source, state):
|
||||
while 1:
|
||||
if b:
|
||||
@ -17,3 +18,29 @@ def _parse(a, b, source, state):
|
||||
break
|
||||
else:
|
||||
raise
|
||||
|
||||
def _parse2(source, state):
|
||||
while 1:
|
||||
if a:
|
||||
if b:
|
||||
while 1:
|
||||
this = 1
|
||||
break
|
||||
continue
|
||||
|
||||
while 1:
|
||||
if b:
|
||||
break
|
||||
|
||||
x = 3
|
||||
|
||||
# Bug was in 2.3 decompilation
|
||||
def _parse3(source, state):
|
||||
while 1:
|
||||
if a:
|
||||
if b:
|
||||
x = 1
|
||||
while 1:
|
||||
if a:
|
||||
break
|
||||
raise
|
||||
|
@ -45,6 +45,8 @@ class Python23Parser(Python24Parser):
|
||||
# a "break" inside "l_stmts".
|
||||
while1stmt ::= _while1test l_stmts COME_FROM JUMP_BACK
|
||||
POP_TOP POP_BLOCK COME_FROM
|
||||
while1stmt ::= _while1test l_stmts JUMP_BACK
|
||||
POP_TOP POP_BLOCK
|
||||
|
||||
list_comp ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR store list_iter del_stmt
|
||||
list_for ::= expr for_iter store list_iter JUMP_BACK come_froms POP_TOP JUMP_BACK
|
||||
|
@ -43,6 +43,8 @@ class Python24Parser(Python25Parser):
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK
|
||||
POP_TOP POP_BLOCK
|
||||
|
||||
continue ::= JUMP_BACK JUMP_ABSOLUTE
|
||||
|
||||
# Python 2.4
|
||||
# The following has no "JUMP_BACK" after l_stmts because
|
||||
# l_stmts ends in a "break", "return", or "continue"
|
||||
|
Loading…
Reference in New Issue
Block a user