Python 3.15 support#186
Conversation
….15+ bytecode on pre-3.15 versions
…t of None out of co_consts and into LOAD_COMMON_CONSTS
…3 supports surrogate code points
…plementation.CPython
Frozendict and big_dict disassembly reference files for 3.15.
| import struct | ||
| import time | ||
|
|
||
| # 1. Compile a simple dummy script |
There was a problem hiding this comment.
It would be nice to remove the (Gemini?) AI numbers. I think the motivation for these is so that when you are in conversation with Gemini or AI, it is easy for you to refer to various steps. However, in the long term, the numbers are going to get in the way and become out of order.
| # ----- configure this for your needs | ||
|
|
||
| lib_prefix = "/usr/lib" | ||
| lib_prefix = os.environ.get("XDIS_LIB_PREFIX", "/usr/lib") |
| source_size) = load_module(mod_file) | ||
| self.assertEqual(version, 2.5, | ||
| source_size, *_) = load_module(mod_file) | ||
| self.assertEqual(version, (2, 5), |
| add_canonic_versions("3.14-dev", "3.14b3") | ||
| add_canonic_versions("3.14 3.14.0 3.14.1, 3.14.2 3.14.3 3.14.4", "3.14rc3") | ||
| add_canonic_versions("3.14 3.14.0 3.14.1, 3.14.2 3.14.3 3.14.4 3.14.5", "3.14rc3") |
| @@ -0,0 +1,414 @@ | |||
| # (C) Copyright 2026 by Rocky Bernstein | |||
There was a problem hiding this comment.
You can substitute your name here. You did the work!
There was a problem hiding this comment.
Oh, sure, I wasn't sure about that lol
I don't know if you want me to make another commit on my branch (maybe awkward since this PR is already merged) or...
I have not that much experience working on PRs for projects like this so I'm not entirely sure what the process is usually like
There was a problem hiding this comment.
Oh, sure, I wasn't sure about that lol I don't know if you want me to make another commit on my branch (maybe awkward since this PR is already merged) or...
I'd be grateful if you just add a new PR with the change .
I have not that much experience working on PRs for projects like this so I'm not entirely sure what the process is usually like
I have much experience and am stil not entire sure what the process is usually like. :-) It tends to change from project to project.
There was a problem hiding this comment.
Done, I opened it as PR #187 with a single commit
Custom formatting can wait. (In the long run it should be generalized more, but this kind of idea will always be around.)
Thanks. Be aware that Python 3.15-dev may change in incompatible ways, and it typically does. I tried running tests on the 3.15-dev, and 3.15a7, and I got failures: The other thing to note is that we support disassembling from an old Python to a current one! And this is done in branches python-3.6-to-3.10 for example. But I've usually been handling the merges from master into these branches. |
|
I'm aware that Python 3.15-dev may change in incompatible ways, but I do believe that now that the beta is released it shouldn't happen? At least, the bytecode is supposed to be frozen now. |
Weirder things have happened in Python bytecode. |
|
Well, I guess I just hope that it doesn't change and if it does I'll have to fix it then |
|
@Quinntyx A couple of things I noticed after merge. The main thing is that new code should not use any Python 3.15isms just yet; it needs to work on Python 3.11. This may change depending on how different 3.15 is from 3.14. In particular, instead of |
|
I'm relatively sure that I haven't used any of the Python 3.15isms as I was testing my branch of xdis using Python 3.14 to run (decompiling 3.15-0b1 bytecode). However, I wasn't aware that list[type] was not available in some older Python versions, thanks for pointing it out! I'll probably also test decompiling 3.15 bytecode from 3.11 and maybe some earlier versions to make sure that I didn't accidentally use any newer features that break compatibility with old versions. |
|
After some research, I see that |
Ok. My mistake then. Thanks for checking. |
|
Okay, thanks for the clarification! |
Implements Python 3.15 support.
This pull request aims to accomplish the following:
unmarshal.pysupport for the newfrozendictbuiltin type (and add tests for it)cross_types.pyto facilitate disassembling 3.15.0 code on pre-3.15 versionsEND_SEND,POP_ITER,GET_ITER,CALL_LIST_APPEND,SEND_GEN,LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN)BINARY_OP_SUBSCR_USTR_INT,CALL_EX_NON_PY_GENERAL,CALL_EX_PY,FOR_ITER_VIRTUAL,GET_ITER_SELF,GET_ITER_VIRTUAL,RESUME_CHECK_JIT,SEND_ASYNC_GEN,SEND_VIRTUAL)There may be things I've missed. In particular, I haven't really touched any of the formatting code. I'll also keep testing this in the coming weeks to make sure it's fully correct.