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

Python 3.11: RuntimeError: Your python version made changes to the bytecode #282

Closed
The-Compiler opened this issue Apr 26, 2022 · 7 comments

Comments

@The-Compiler
Copy link

With Python 3.11.0a7, import js2py results in:

b'\x97\x00|\x00j\x00}\x01t\x03t\x05|\x00\xa6\x01\xab\x01\xa6\x01\xab\x01}\x02i\x00}\x03g\x00}\x04|\x02D\x00]A}\x05|\x05|\x03t\x07|\x04\xa6\x01\xab\x01<\x00|\x04\xa0\x04t\x0b|\x05j\x06|\x05j\x07\xa6\x02\xab\x02\xa6\x01\xab\x01\x01\x00\x8cBt\x10j\tr\x8ed\x01\xa0\n|\x04\xa6\x01\xab\x01}\x06n\x0ft\x17|\x04\xa6\x01\xab\x01}\x06|\x06|\x01k\x03\x90\x01r\xact\x19|\x06\xa6\x01\xab\x01\x01\x00t\x19|\x01\xa6\x01\xab\x01\x01\x00t\x1bt\x1dt\x07|\x06\xa6\x01\xab\x01t\x07|\x01\xa6\x01\xab\x01\xa6\x02\xab\x02\xa6\x01\xab\x01D\x00]\xb4}\x07|\x01|\x07\x19\x00|\x06|\x07\x19\x00k\x03\x90\x01r\x9d\t\x00|\x07|\x03v\x00\x90\x01r\x9ct\x19|\x03|\x07\x19\x00\xa6\x01\xab\x01\x01\x00t\x19|\x03|\x07d\x03z\n\x19\x00\xa6\x01\xab\x01\x01\x00t\x19t\x03t\x1ft |\x01\xa6\x02\xab\x02\xa6\x01\xab\x01|\x07d\x04z\n|\x07d\x05z\x00\x85\x02\x19\x00\xa6\x01\xab\x01\x01\x00t\x19|\x04|\x07d\x04z\n|\x07d\x05z\x00\x85\x02\x19\x00\xa6\x01\xab\x01\x01\x00n\x01\x8c\x8et#d\x06\xa6\x01\xab\x01\x82\x01d\x00S\x00d\x00S\x00'
b'\x97\x00|\x00j\x00\x00\x00\x00\x00\x00\x00\x00\x00}\x01t\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00}\x02i\x00}\x03g\x00}\x04|\x02D\x00]A}\x05|\x05|\x03t\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00<\x00\x00\x00|\x04\xa0\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x05j\x06\x00\x00\x00\x00\x00\x00\x00\x00|\x05j\x07\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x8cBt\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j\t\x00\x00\x00\x00\x00\x00\x00\x00r\x8ed\x01\xa0\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00}\x06n\x0ft\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x04\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00}\x06|\x06|\x01k\x03\x00\x00\x00\x00\x90\x01r\xact\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x06\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00t\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x01\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00t\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x06\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00t\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x01\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00D\x00]\xb4}\x07|\x01|\x07\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x06|\x07\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00k\x03\x00\x00\x00\x00\x90\x01r\x9d\t\x00|\x07|\x03v\x00\x90\x01r\x9ct\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x03|\x07\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00t\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x03|\x07d\x03z\n\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00t\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x01\xa6\x02\x00\x00\xab\x02\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00|\x07d\x04z\n\x00\x00|\x07d\x05z\x00\x00\x00\x85\x02\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00t\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x04|\x07d\x04z\n\x00\x00|\x07d\x05z\x00\x00\x00\x85\x02\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00n\x01\x8c\x8et#\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00d\x06\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x82\x01d\x00S\x00d\x00S\x00'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/florian/tmp/lark/.tox/py311/lib/python3.11/site-packages/js2py/__init__.py", line 72, in <module>
    from .base import PyJsException
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/lark/.tox/py311/lib/python3.11/site-packages/js2py/base.py", line 6, in <module>
    from .utils.injector import fix_js_args
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/lark/.tox/py311/lib/python3.11/site-packages/js2py/utils/injector.py", line 224, in <module>
    check(six.get_function_code(check))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/florian/tmp/lark/.tox/py311/lib/python3.11/site-packages/js2py/utils/injector.py", line 220, in check
    raise RuntimeError(
    ^^^^^^^^^^^^^^^^^^^
RuntimeError: Your python version made changes to the bytecode
@inikishev
Copy link

what does this mean cuz I have the same issue but with a different package

@inikishev
Copy link

"Your python version made changes to the bytecode" what in the world could that even mean

@PiotrDabkowski
Copy link
Owner

PiotrDabkowski commented Nov 3, 2022

Yeah, it seems Python 3.11 modified the bytecode specification, and the bytecode manipulations done by Js2Py do not work in that version. Given that 3.11 will become more used now it is quite important to fix this issue.

I am bit busy now with my startup so any contributions welcome! Otherwise I will try to fix that later on when I find some time.

Edit: 3.11 is out, I will fix now.

@devenu85
Copy link

devenu85 commented Nov 6, 2022

please fix this asap.

@4144
Copy link
Contributor

4144 commented Nov 26, 2022

In 3.12.0a2+ (current main branch) fail in injector.py too

@PiotrDabkowski
Copy link
Owner

Ehh why do they change bytecode so frequently now? It was stabole for years... Adjusting it after bytecode change is relatively hard because I need to reverse engineer it due to poor documentation.
If anybody wants to play with 3.12, contributions very welcome!

@ylm-king
Copy link

good lib, and wait python3.12 support +1

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

No branches or pull requests

6 participants