You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Python 3 "while True" bug
This commit is contained in:
BIN
test/bytecode_3.5/09_whiletrue_bug.pyc
Normal file
BIN
test/bytecode_3.5/09_whiletrue_bug.pyc
Normal file
Binary file not shown.
9
test/simple_source/stmts/09_whiletrue_bug.py
Normal file
9
test/simple_source/stmts/09_whiletrue_bug.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
if args == ['-']:
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
compile(filename, doraise=True)
|
||||||
|
except RuntimeError:
|
||||||
|
rv = 1
|
||||||
|
else:
|
||||||
|
rv = 1
|
||||||
|
print(rv)
|
@@ -330,6 +330,13 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
def p_stmt3(self, args):
|
||||||
|
"""
|
||||||
|
stmt ::= whileTruestmt
|
||||||
|
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK _come_from
|
||||||
|
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_from
|
||||||
|
"""
|
||||||
|
|
||||||
def p_genexpr3(self, args):
|
def p_genexpr3(self, args):
|
||||||
'''
|
'''
|
||||||
load_genexpr ::= LOAD_GENEXPR
|
load_genexpr ::= LOAD_GENEXPR
|
||||||
|
@@ -302,6 +302,7 @@ TABLE_DIRECT = {
|
|||||||
'ifelsestmtr': ( '%|if %c:\n%+%c%-%|else:\n%+%c%-', 0, 1, 2 ),
|
'ifelsestmtr': ( '%|if %c:\n%+%c%-%|else:\n%+%c%-', 0, 1, 2 ),
|
||||||
'elifelsestmtr': ( '%|elif %c:\n%+%c%-%|else:\n%+%c%-\n\n', 0, 1, 2 ),
|
'elifelsestmtr': ( '%|elif %c:\n%+%c%-%|else:\n%+%c%-\n\n', 0, 1, 2 ),
|
||||||
|
|
||||||
|
'whileTruestmt': ( '%|while True:\n%+%c%-\n\n', 1 ),
|
||||||
'whilestmt': ( '%|while %c:\n%+%c%-\n\n', 1, 2 ),
|
'whilestmt': ( '%|while %c:\n%+%c%-\n\n', 1, 2 ),
|
||||||
'while1stmt': ( '%|while 1:\n%+%c%-\n\n', 1 ),
|
'while1stmt': ( '%|while 1:\n%+%c%-\n\n', 1 ),
|
||||||
'while1elsestmt': ( '%|while 1:\n%+%c%-%|else:\n%+%c%-\n\n', 1, 3 ),
|
'while1elsestmt': ( '%|while 1:\n%+%c%-%|else:\n%+%c%-\n\n', 1, 3 ),
|
||||||
|
Reference in New Issue
Block a user