You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Fix Python 2 cross deparsing pythond bytecode tuples co_consts,
co_names, co_varnames. Reinstate cross Python 2-3 uncompiling
This commit is contained in:
@@ -20,7 +20,7 @@ check:
|
||||
$(MAKE) check-$$PYTHON_VERSION
|
||||
|
||||
#: Run working tests from Python 2.6 or 2.7
|
||||
check-2.6 check-2.7: check-bytecode-2 check-2.7-ok
|
||||
check-2.6 check-2.7: check-bytecode check-2.7-ok
|
||||
|
||||
#: Run working tests from Python 3.3
|
||||
check-3.3: check-bytecode
|
||||
|
@@ -126,9 +126,9 @@ def load_code_type(fp, magic_int, bytes_for_s=False, code_objects={}):
|
||||
if (3000 <= magic_int < 20121):
|
||||
# Python 3 encodes some fields as Unicode while Python2
|
||||
# requires the corresponding field to have string values
|
||||
co_consts = tuple([str(s) if s else None for s in co_consts])
|
||||
co_names = tuple([str(s) if s else None for s in co_names])
|
||||
co_varnames = tuple([str(s) if s else None for s in co_varnames])
|
||||
co_consts = tuple([str(s) if isinstance(s, unicode) else s for s in co_consts])
|
||||
co_names = tuple([str(s) if isinstance(s, unicode) else s for s in co_names])
|
||||
co_varnames = tuple([str(s) if isinstance(s, unicode) else s for s in co_varnames])
|
||||
co_filename = str(co_filename)
|
||||
co_name = str(co_name)
|
||||
if 3020 < magic_int <= 20121:
|
||||
|
Reference in New Issue
Block a user