11#!/usr/bin/env python3
22# -*- coding: iso-8859-1 -*-
3- # Copyright (C) 2008-2010, 2013-2018, 2020-2021 Rocky Bernstein
3+ # Copyright (C) 2008-2010, 2013-2018, 2020-2022 Rocky Bernstein
44# <rocky@gnu.org>
55#
66# This program is free software: you can redistribute it and/or modify
@@ -100,7 +100,12 @@ def main(dbg=None, sys_argv=list(sys.argv)):
100100
101101 if Mfile .is_compiled_py (mainpyfile ):
102102 try :
103- from xdis import load_module , PYTHON_VERSION , IS_PYPY
103+ from xdis import (
104+ load_module ,
105+ PYTHON_VERSION_TRIPLE ,
106+ IS_PYPY ,
107+ version_tuple_to_str ,
108+ )
104109
105110 (
106111 python_version ,
@@ -115,10 +120,10 @@ def main(dbg=None, sys_argv=list(sys.argv)):
115120 print ("Bytecode is pypy %s, but we are %s." % (is_pypy , IS_PYPY ))
116121 print ("For a cross-version debugger, use trepan-xpy with x-python." )
117122 sys .exit (2 )
118- if python_version != PYTHON_VERSION :
123+ if python_version [: 2 ] != PYTHON_VERSION_TRIPLE [: 2 ] :
119124 print (
120125 "Bytecode is for version %s but we are version %s."
121- % (python_version , PYTHON_VERSION )
126+ % (python_version , version_tuple_to_str () )
122127 )
123128 print ("For a cross-version debugger, use trepan-xpy with x-python." )
124129 sys .exit (2 )
@@ -147,7 +152,7 @@ def main(dbg=None, sys_argv=list(sys.argv)):
147152 except IOError :
148153 decompiler = "uncompyle6"
149154 try :
150- if 3.7 <= PYTHON_VERSION <= 3.8 :
155+ if ( 3 , 7 ) <= PYTHON_VERSION_TRIPLE <= ( 3 , 8 ) :
151156 from uncompyle6 import decompile_file
152157 else :
153158 from decompyle3 import decompile_file
0 commit comments