You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Better handling of bytecode errors
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys, os, getopt, time
|
import sys, os, getopt, time
|
||||||
|
from xdis.version_info import version_tuple_to_str
|
||||||
|
|
||||||
program = 'uncompyle6'
|
program = 'uncompyle6'
|
||||||
|
|
||||||
@@ -76,8 +77,10 @@ def main_bin():
|
|||||||
(3, 4), (3, 5), (3, 6),
|
(3, 4), (3, 5), (3, 6),
|
||||||
(3, 7), (3, 8), (3, 9), (3, 10)
|
(3, 7), (3, 8), (3, 9), (3, 10)
|
||||||
)):
|
)):
|
||||||
print('Error: %s requires Python 2.4-3.10' % program,
|
print(
|
||||||
file=sys.stderr)
|
f"Error: {program} can decompile only bytecode from Python 3.7"
|
||||||
|
f""" to 3.8.\n\tYou have version: {version_tuple_to_str()}."""
|
||||||
|
)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
do_verify = recurse_dirs = False
|
do_verify = recurse_dirs = False
|
||||||
@@ -197,6 +200,9 @@ def main_bin():
|
|||||||
mess = status_msg(do_verify, *result)
|
mess = status_msg(do_verify, *result)
|
||||||
print('# ' + mess)
|
print('# ' + mess)
|
||||||
pass
|
pass
|
||||||
|
except ImportError as e:
|
||||||
|
print(str(e))
|
||||||
|
sys.exit(2)
|
||||||
except (KeyboardInterrupt):
|
except (KeyboardInterrupt):
|
||||||
pass
|
pass
|
||||||
except verify.VerifyCmpError:
|
except verify.VerifyCmpError:
|
||||||
|
Reference in New Issue
Block a user