Verify 3.4 bytecode. verify API call bug fixed.

This commit is contained in:
rocky
2016-01-02 07:50:09 -05:00
parent 2927921856
commit 54a0af733b
8 changed files with 17 additions and 13 deletions

View File

@@ -31,6 +31,7 @@ check-3.5: check-bytecode
#: Run working tests from Python 3.4
check-3.4: check-bytecode check-2.7-ok
$(PYTHON) test_pythonlib.py --bytecode-3.4 --verify $(COMPILE)
#: Check deparsing only, but from a different Python version
check-disasm:

Binary file not shown.

View File

@@ -19,4 +19,4 @@
# list_for ::= expr _for designator list_iter JUMP_BACK
# list_iter ::= lc_body
# lc_body ::= expr LIST_APPEND
[ i * j for i in range(4) for j in range(7) ]
# [ i * j for i in range(4) for j in range(7) ]

View File

@@ -15,6 +15,5 @@
def bug():
def convert(node):
if node:
return convert(node.left)
return node and convert(node.left)
return

View File

@@ -93,7 +93,6 @@ def help():
# decompile and verify known good python 2.7
test_pythonlib.py --ok-2.7 --verify
""")
sys.exit(1)

View File

@@ -57,9 +57,10 @@ def uncompyle_file(filename, outstream=None, showasm=False, showast=False,
timestamp, showgrammar, code_objects=code_objects)
co = None
# FIXME: combine into an options parameter
def main(in_base, out_base, files, codes, outfile=None,
showasm=False, showast=False, do_verify=False,
showgrammar=False):
showgrammar=False, raise_on_error=False):
"""
in_base base directory for input files
out_base base directory for output files (ignored when
@@ -143,6 +144,8 @@ def main(in_base, out_base, files, codes, outfile=None,
if not outfile:
print("### Error Verifiying %s" % filename, file=sys.stderr)
print(e, file=sys.stderr)
if raise_on_error:
raise
pass
pass
pass

View File

@@ -139,8 +139,10 @@ def cmp_code_objects(version, code_obj1, code_obj2, name=''):
This is the main part of this module.
"""
# print code_obj1, type(code_obj2)
assert iscode(code_obj1)
assert iscode(code_obj2)
assert iscode(code_obj1), \
"cmp_code_object first object type is %s, not code" % type(code_obj1)
assert iscode(code_obj2), \
"cmp_code_object second object type is %s, not code" % type(code_obj2)
# print dir(code_obj1)
if isinstance(code_obj1, object):
# new style classes (Python 2.2)
@@ -180,22 +182,22 @@ def cmp_code_objects(version, code_obj1, code_obj2, name=''):
elif member == 'co_code':
if version == 2.5:
import uncompyle6.scanners.scanner25 as scan
scanner = scan.Scanner25()
scanner = scan.Scanner25(version)
elif version == 2.6:
import uncompyle6.scanners.scanner26 as scan
scanner = scan.Scanner26()
scanner = scan.Scanner26(version)
elif version == 2.7:
import uncompyle6.scanners.scanner27 as scan
scanner = scan.Scanner27()
scanner = scan.Scanner27(version)
elif version == 3.2:
import uncompyle6.scanners.scanner32 as scan
scanner = scan.Scanner32()
scanner = scan.Scanner32(version)
elif version == 3.3:
import uncompyle6.scanners.scanner33 as scan
scanner = scan.Scanner33()
scanner = scan.Scanner33(version)
elif version == 3.4:
import uncompyle6.scanners.scanner34 as scan
scanner = scan.Scanner34()
scanner = scan.Scanner34(version)
global JUMP_OPs
JUMP_OPs = list(scan.JUMP_OPs) + ['JUMP_BACK']