Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_opcode_module fails to detect 3-digit versions #71

Closed
olafhering opened this issue Dec 30, 2020 · 2 comments
Closed

get_opcode_module fails to detect 3-digit versions #71

olafhering opened this issue Dec 30, 2020 · 2 comments

Comments

@olafhering
Copy link

Unclear how it is supposed to work.
get_opcode_module fails to handle 3.6.12|3.8.6, and likely every 3.6.n|3.8.n.

$ uncompyle6 -h
Traceback (most recent call last):
  File "/usr/bin/uncompyle6", line 11, in <module>
    load_entry_point('uncompyle6==3.7.2', 'console_scripts', 'uncompyle6')()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.8/site-packages/uncompyle6/__init__.py", line 48, in <module>
    import uncompyle6.semantics.pysource
  File "/usr/lib/python3.8/site-packages/uncompyle6/semantics/pysource.py", line 141, in <module>
    from uncompyle6.parsers.treenode import SyntaxTree
  File "/usr/lib/python3.8/site-packages/uncompyle6/parsers/treenode.py", line 3, in <module>
    from uncompyle6.scanners.tok import NoneToken
  File "/usr/lib/python3.8/site-packages/uncompyle6/scanners/tok.py", line 200, in <module>
    NoneToken = Token("LOAD_CONST", offset=-1, attr=None, pattr=None)
  File "/usr/lib/python3.8/site-packages/uncompyle6/scanners/tok.py", line 86, in __init__
    from xdis.std import _std_api
  File "/usr/lib/python3.8/site-packages/xdis/std.py", line 220, in <module>
    _std_api = make_std_api()
  File "/usr/lib/python3.8/site-packages/xdis/std.py", line 218, in make_std_api
    return _StdApi(python_version, variant)
  File "/usr/lib/python3.8/site-packages/xdis/std.py", line 73, in __init__
    self.opc = opc = get_opcode_module(python_version, variant)
  File "/usr/lib/python3.8/site-packages/xdis/op_imports.py", line 169, in get_opcode_module
    return op_imports[canonic_python_version[vers_str]]
KeyError: '3.8.6'

Workaround is version_info[0:2] to find a match.

Unclear what the openSUSE Leap and Tumbleweed packages do wrong.

@rocky
Copy link
Owner

rocky commented Dec 30, 2020

The traceback shows you are using uncompyle6 3.7.2.

Do yourself and me a favor and look up on and see what the latest version of uncompyle6 is. There are a number of ways to do this, but here is a link. In the Holiday/Christmas spirit, look at all of the red and green!

Also try this with xdis.

The reflect a minute: new versions of Python come out all of the time. Although it is a maintanance mess, we note that specific version numbers are associated with specific magic numbers. And we note those only for the Pythons that have really been released: If there is no such thing as a Python 3.8.100232 we don't purport to know anything about that.

You could imagine a different organization. And if you want to do the work to make it happen I'll entertain the idea, if it is viable.

@olafhering
Copy link
Author

This approach clashes with reality.

I have adjusted the openSUSE packages in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants