You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Merge branch 'master' of github.com:rocky/python-uncompyle6
This commit is contained in:
BIN
test/bytecode_2.4/03_whileelse_bug.pyc
Normal file
BIN
test/bytecode_2.4/03_whileelse_bug.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.6/03_whileelse_bug.pyc
Normal file
BIN
test/bytecode_2.6/03_whileelse_bug.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7/03_whileelse_bug.pyc
Normal file
BIN
test/bytecode_2.7/03_whileelse_bug.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.3/03_whileelse_bug.pyc
Normal file
BIN
test/bytecode_3.3/03_whileelse_bug.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.4/03_whileelse_bug.pyc
Normal file
BIN
test/bytecode_3.4/03_whileelse_bug.pyc
Normal file
Binary file not shown.
9
test/simple_source/looping/03_whileelse_bug.py
Normal file
9
test/simple_source/looping/03_whileelse_bug.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# From idlelib/PyParse.py
|
||||
# Bug is "if" inside a nested while/else.
|
||||
def _study1(i, n):
|
||||
while i:
|
||||
while i:
|
||||
i = 0
|
||||
else:
|
||||
if i:
|
||||
i = 1
|
@@ -21,22 +21,25 @@ Step 2: Run the test:
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from uncompyle6 import main, PYTHON3
|
||||
import os, time, shutil, sys
|
||||
import os, time, re, shutil, sys
|
||||
from fnmatch import fnmatch
|
||||
|
||||
from uncompyle6 import main, PYTHON3
|
||||
import xdis.magics as magics
|
||||
|
||||
#----- configure this for your needs
|
||||
|
||||
python_versions = [v for v in magics.python_versions if
|
||||
re.match('^[0-9.]+$', v)]
|
||||
|
||||
# FIXME: we should remove Python versions that we don't support.
|
||||
# These include Jython, and Python bytecode changes pre release.
|
||||
|
||||
TEST_VERSIONS=(
|
||||
'pypy-2.4.0', 'pypy-2.6.1',
|
||||
'pypy-5.0.1', 'pypy-5.3.1', 'pypy3.5-5.7.1-beta',
|
||||
# FIXME: get this from xdis magics.
|
||||
'2.3.7', '2.4.6', '2.5.6', '2.6.9',
|
||||
'2.7.10', '2.7.11', '2.7.12', '2.7.13', '2.7.14',
|
||||
'3.0.1', '3.1.5', '3.2.6',
|
||||
'3.3.5', '3.3.6', '3.3.7',
|
||||
'3.4.2', '3.5.3', '3.6.0', '3.6.3', '3.6.4',
|
||||
'native')
|
||||
'native') + tuple(python_versions)
|
||||
|
||||
|
||||
target_base = '/tmp/py-dis/'
|
||||
lib_prefix = os.path.join(os.environ['HOME'], '.pyenv/versions')
|
||||
|
@@ -185,6 +185,10 @@ def main(in_base, out_base, files, codes, outfile=None,
|
||||
okay_files += 1
|
||||
else:
|
||||
print('\n# %s\n\t%s', infile, msg)
|
||||
pass
|
||||
else:
|
||||
okay_files += 1
|
||||
pass
|
||||
except verify.VerifyCmpError as e:
|
||||
print(e)
|
||||
verify_failed_files += 1
|
||||
@@ -196,6 +200,9 @@ def main(in_base, out_base, files, codes, outfile=None,
|
||||
raise
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
else:
|
||||
okay_files += 1
|
||||
pass
|
||||
elif do_verify:
|
||||
sys.stderr.write("\n### uncompile successful, but no file to compare against\n")
|
||||
|
@@ -142,8 +142,8 @@ class Python26Parser(Python2Parser):
|
||||
whilestmt ::= SETUP_LOOP testexpr returns POP_BLOCK COME_FROM
|
||||
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK
|
||||
else_suite COME_FROM
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suite COME_FROM
|
||||
else_suitel COME_FROM
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK else_suitel COME_FROM
|
||||
|
||||
return ::= ret_expr RETURN_END_IF POP_TOP
|
||||
return ::= ret_expr RETURN_VALUE POP_TOP
|
||||
|
@@ -120,9 +120,9 @@ class Python27Parser(Python2Parser):
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK _come_froms
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK
|
||||
else_suite COME_FROM
|
||||
else_suitel COME_FROM
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||
else_suite COME_FROM
|
||||
else_suitel COME_FROM
|
||||
|
||||
ifstmt ::= testexpr return_if_stmts COME_FROM
|
||||
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite COME_FROM
|
||||
|
@@ -347,10 +347,10 @@ class Python3Parser(PythonParser):
|
||||
COME_FROM_LOOP
|
||||
|
||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK
|
||||
else_suite
|
||||
else_suitel
|
||||
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||
else_suite COME_FROM_LOOP
|
||||
else_suitel COME_FROM_LOOP
|
||||
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK
|
||||
COME_FROM_LOOP
|
||||
|
@@ -19,9 +19,9 @@ class Python34Parser(Python33Parser):
|
||||
|
||||
|
||||
# FIXME the below masks a bug in not detecting COME_FROM_LOOP
|
||||
# grammar rules with COME_FROM -> COME_FROM_LOOP alreadly exist
|
||||
# grammar rules with COME_FROM -> COME_FROM_LOOP already exist
|
||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||
else_suite COME_FROM
|
||||
else_suitel COME_FROM
|
||||
|
||||
# Python 3.4+ optimizes the trailing two JUMPS away
|
||||
|
||||
|
Reference in New Issue
Block a user