-
-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Description
Description
bytecode_version is annotated as a str, but decompile in reality only accepts tuples.
How to Reproduce
>>> from uncompyle6.main import decompile
>>> def a():print("hello world")
...
>>> decompile(a.__code__,"3.8")
# uncompyle6 version 3.9.0a1
# Python bytecode version base 3...8
# Decompiled from: Python 3.9.12 (main, Mar 24 2022, 13:02:21)
# [GCC 11.2.0]
# Embedded file name: <stdin>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/redacted/.local/lib/python3.9/site-packages/uncompyle6/main.py", line 143, in decompile
deparsed = deparse_fn(
File "/home/redacted/.local/lib/python3.9/site-packages/uncompyle6/semantics/pysource.py", line 1471, in code_deparse
deparsed = walker(
File "/home/redacted/.local/lib/python3.9/site-packages/uncompyle6/semantics/pysource.py", line 314, in __init__
customize_for_version(self, is_pypy, version)
File "/home/redacted/.local/lib/python3.9/site-packages/uncompyle6/semantics/customize.py", line 112, in customize_for_version
if version >= (3, 0):
TypeError: '>=' not supported between instances of 'str' and 'tuple'Expected behavior
Either strings should be accepted, or the type annotation be changed to tuple[int].
Environment
uncompyle6 3.9.0a1
(I installed the latest version from github)
3.9.12 (main, Mar 24 2022, 13:02:21)
[GCC 11.2.0]
Workarounds
Pass tuple(map(int,version.split("."))) instead
Metadata
Metadata
Assignees
Labels
No labels