Skip to content

Commit 1cb31a8

Browse files
committed
decompile bytecode_version defaults to Python intepreter version
Fixes rocky#189
1 parent 7d1ecf9 commit 1cb31a8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

uncompyle6/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from uncompyle6 import verify, IS_PYPY, PYTHON_VERSION
1919
from xdis.code import iscode
20+
from xdis.magics import sysinfo2float
2021
from uncompyle6.disas import check_object_path
2122
from uncompyle6.semantics import pysource
2223
from uncompyle6.parser import ParserError
@@ -52,8 +53,14 @@ def decompile(
5253
"""
5354
ingests and deparses a given code block 'co'
5455
56+
if `bytecode_version` is None, use the current Python intepreter
57+
version.
58+
5559
Caller is responsible for closing `out` and `mapstream`
5660
"""
61+
if bytecode_version is None:
62+
bytecode_version = sysinfo2float()
63+
5764
# store final output stream for case of error
5865
real_out = out or sys.stdout
5966

0 commit comments

Comments
 (0)