2525
2626from xdis import iscode
2727from xdis .load import load_module
28- from xdis .version_info import IS_PYPY , PYTHON_VERSION_TRIPLE , version_tuple_to_str
28+ from xdis .version_info import (
29+ IS_PYPY ,
30+ PYTHON_VERSION_TRIPLE ,
31+ PythonImplementation ,
32+ version_tuple_to_str ,
33+ )
2934
3035from uncompyle6 .code_fns import check_object_path
3136from uncompyle6 .parser import ParserError
@@ -113,7 +118,7 @@ def write(s):
113118 write (f"# -*- coding: { source_encoding } -*-" )
114119 write (
115120 "# uncompyle6 version %s\n "
116- "# %sPython bytecode version base %s%s\n # Decompiled from: %sPython %s"
121+ "# %sPython bytecode version base %s%s\n # Decompiled from: %sPython %s"
117122 % (
118123 __version__ ,
119124 co_pypy_str ,
@@ -216,9 +221,16 @@ def decompile_file(
216221
217222 filename = check_object_path (filename )
218223 code_objects = {}
219- version , timestamp , magic_int , co , is_pypy , source_size , _ = load_module (
220- filename , code_objects
221- )
224+ (
225+ version ,
226+ timestamp ,
227+ magic_int ,
228+ co ,
229+ python_implementation ,
230+ source_size ,
231+ _ ,
232+ _ ,
233+ ) = load_module (filename , code_objects )
222234
223235 if isinstance (co , list ):
224236 deparsed = []
@@ -234,7 +246,7 @@ def decompile_file(
234246 showgrammar ,
235247 source_encoding ,
236248 code_objects = code_objects ,
237- is_pypy = is_pypy ,
249+ is_pypy = python_implementation == PythonImplementation . PyPy ,
238250 magic_int = magic_int ,
239251 mapstream = mapstream ,
240252 start_offset = start_offset ,
@@ -254,7 +266,7 @@ def decompile_file(
254266 source_encoding ,
255267 code_objects = code_objects ,
256268 source_size = source_size ,
257- is_pypy = is_pypy ,
269+ is_pypy = python_implementation == PythonImplementation . PyPy ,
258270 magic_int = magic_int ,
259271 mapstream = mapstream ,
260272 do_fragments = do_fragments ,
0 commit comments