rocky / python-uncompyle6

A cross-version Python bytecode decompiler
GNU General Public License v3.0
3.79k stars 413 forks source link

running uncompyle6 throws a KeyError #422

Closed eltrevii closed 1 year ago

eltrevii commented 1 year ago

Description

How to Reproduce

pip install uncompyle6
uncompyle6

Output Given

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python311\Scripts\uncompyle6.exe\__main__.py", line 4, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\uncompyle6\__init__.py", line 53, in <module>
    import uncompyle6.semantics.pysource
  File "C:\Program Files\Python311\Lib\site-packages\uncompyle6\semantics\pysource.py", line 141, in <module>
    from uncompyle6.parsers.treenode import SyntaxTree
  File "C:\Program Files\Python311\Lib\site-packages\uncompyle6\parsers\treenode.py", line 3, in <module>
    from uncompyle6.scanners.tok import NoneToken
  File "C:\Program Files\Python311\Lib\site-packages\uncompyle6\scanners\tok.py", line 200, in <module>
    NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\uncompyle6\scanners\tok.py", line 86, in __init__
    from xdis.std import _std_api
  File "C:\Program Files\Python311\Lib\site-packages\xdis\std.py", line 220, in <module>
    _std_api = make_std_api()
               ^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\xdis\std.py", line 218, in make_std_api
    return _StdApi(python_version, variant)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\xdis\std.py", line 73, in __init__
    self.opc = opc = get_opcode_module(python_version, variant)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\xdis\op_imports.py", line 174, in get_opcode_module
    return op_imports[canonic_python_version[vers_str]]
                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: '3.11.0'

Expected behavior

showing a usage message or something, like usage: uncompyle6 ...

Environment

if there was a workaround i wouldnt have made this issue

Priority

Additional Context

rocky commented 1 year ago

This is actually a problem in the cross disassembler xdis. Right now no one has added 3.11 opcodes for that or checked it out for 3.11. I have opened issue https://github.com/rocky/python-xdis/issues/98 for this.

Note that it needs a volunteer to fix - hey, how about you?

if there was a workaround i wouldnt [sic] have made this issue

@aritz331 There always is a workaround. This is open-source code, and so is xdis. So you can always go into either and adjust the code.

eltrevii commented 1 year ago

@rocky im not a python dev

rocky commented 1 year ago

@aritz331 Ok - then another workaround is to pay a python dev to do the things that you can't do.

eltrevii commented 1 year ago

@rocky are you serious?

rocky commented 1 year ago

@aritz331 Here is some serious advice - to increase the likelihood of issues you report getting worked on by others, (since as you say you aren't able or likely to to do this yourself), you should cut out the attitude in the issue reporting and conversations.

Oh and by the way, if this weren't open source you wouldn't expect someone to volunteer to fix issues.

eltrevii commented 1 year ago

ok whatever