Handle verify syntax errors...

Update README.rst stats
This commit is contained in:
rocky
2016-11-13 18:55:23 -05:00
parent ee6dddd25a
commit b6e53205dd
2 changed files with 9 additions and 4 deletions

View File

@@ -100,11 +100,13 @@ The biggest known and possibly fixable (but hard) problem has to do
with handling control flow. In some cases we can detect an erroneous with handling control flow. In some cases we can detect an erroneous
decompilation and report that. decompilation and report that.
About 90% of the decompilation verifies from Python 2.3.7 to Python About 90% of the decompilation of Python standard library packages in
3.4.2 on the standard library packages I have on my system. Python 2.7.12 verifies correctly. Over 99% of Python 2.7 and 3.3-3.5
"weakly" verify. Python 2.6 drops down to 96% weakly verifying.
Other versions drop off in quality too.
*Verification* is the process of decompiling bytecode, compiling with *Verification* is the process of decompiling bytecode, compiling with
a Python for that byecode version, and then comparing the bytecode a Python for that bytecode version, and then comparing the bytecode
produced by the decompiled/compiled program. Some allowance is made produced by the decompiled/compiled program. Some allowance is made
for inessential differences. But other semantically equivalent for inessential differences. But other semantically equivalent
differences are not caught. For example ``if x: foo()`` is differences are not caught. For example ``if x: foo()`` is

View File

@@ -395,7 +395,10 @@ def compare_code_with_srcfile(pyc_filename, src_filename, weak_verify=False):
msg = ("Can't compare code - Python is running with magic %s, but code is magic %s " msg = ("Can't compare code - Python is running with magic %s, but code is magic %s "
% (PYTHON_MAGIC_INT, magic_int)) % (PYTHON_MAGIC_INT, magic_int))
return msg return msg
code_obj2 = load_file(src_filename) try:
code_obj2 = load_file(src_filename)
except SyntaxError as e:
return str(e)
cmp_code_objects(version, is_pypy, code_obj1, code_obj2, ignore_code=weak_verify) cmp_code_objects(version, is_pypy, code_obj1, code_obj2, ignore_code=weak_verify)
return None return None