Skip to content

Commit f0565b2

Browse files
committed
sync verify with 3.6 branch
1 parent 329d331 commit f0565b2

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

uncompyle6/verify.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
byte-code verification
1919
"""
2020

21-
from __future__ import print_function
22-
2321
import operator
2422
import sys
2523
from functools import reduce
2624
from subprocess import call
2725

2826
import xdis.std as dis
2927
from xdis import PYTHON_MAGIC_INT, iscode, load_file, load_module, pretty_code_flags
28+
from xdis.version_info import PythonImplementation
3029

31-
import uncompyle6
3230
from uncompyle6.scanner import Token as ScannerToken, get_scanner
3331

3432
truediv = operator.truediv
@@ -487,9 +485,10 @@ def compare_code_with_srcfile(pyc_filename, src_filename, verify):
487485
timestamp,
488486
magic_int,
489487
code_obj1,
490-
is_pypy,
488+
python_implementation,
491489
source_size,
492490
sip_hash,
491+
_,
493492
) = load_module(pyc_filename)
494493
if magic_int != PYTHON_MAGIC_INT:
495494
msg = (
@@ -502,7 +501,7 @@ def compare_code_with_srcfile(pyc_filename, src_filename, verify):
502501
except SyntaxError as e:
503502
# src_filename can be the first of a group sometimes
504503
return str(e).replace(src_filename, pyc_filename)
505-
cmp_code_objects(version, is_pypy, code_obj1, code_obj2, verify)
504+
cmp_code_objects(version, python_implementation, code_obj1, code_obj2, verify)
506505
if verify == "verify-run":
507506
try:
508507
retcode = call("%s %s" % (sys.executable, src_filename), shell=True)
@@ -522,19 +521,22 @@ def compare_files(pyc_filename1, pyc_filename2, verify):
522521
timestamp,
523522
magic_int1,
524523
code_obj1,
525-
is_pypy,
524+
python_implementation,
526525
source_size,
527526
sip_hash,
528-
) = uncompyle6.load_module(pyc_filename1)
527+
_,
528+
) = load_module(pyc_filename1)
529+
is_pypy = python_implementation is PythonImplementation.PyPy
529530
(
530531
version2,
531532
timestamp,
532533
magic_int2,
533534
code_obj2,
534-
is_pypy,
535+
python_implementation,
535536
source_size,
536537
sip_hash,
537-
) = uncompyle6.load_module(pyc_filename2)
538+
_,
539+
) = load_module(pyc_filename2)
538540
if (magic_int1 != magic_int2) and verify == "verify":
539541
verify = "weak_verify"
540542
cmp_code_objects(version1, is_pypy, code_obj1, code_obj2, verify)

0 commit comments

Comments
 (0)