News for hackers. Stuff that matters.
Re:The Design and Implementation of the CPython Virtual Machine by acheong08 on Sunday September 01, 2024 @10:24AM (#41417210)
Very informative read. I wonder if it’s start becoming more popular for people to compile & distribute Python byte code once the JIT is done similar to how Java does it.
Re:The Design and Implementation of the CPython Virtual Machine by munch117 on Sunday September 01, 2024 @11:44AM (#41417832)
Unlike JVM byte code, CPython byte code is not a stable target. It can and does change from one minor version to the next.

So far, it has remained recognisable from one version to the next - someone used to reading (disassembled) CPython 2.7 bytecode would feel right at home reading CPython 3.11 bytecode, for example. But there's no guarantee that it will remain so, and with the faster-cpython project going on, we should probably expect it to change more in the future than we've been used to.

Re:The Design and Implementation of the CPython Virtual Machine by Someone on Sunday September 01, 2024 @11:46AM (#41417841)
To make that popular, there would have to be at least some guarantee that bytecode distributed to another system can run there.

However, AFAIK, Python currently makes no guarantee at all about bytecode compatibility between versions, and there are no plans to change that.

Re:The Design and Implementation of the CPython Virtual Machine by jepler on Sunday September 01, 2024 @10:51AM (#41417426)
This is quite possible, and I'm sure someone's doing it. At $OLD_DAY_JOB I developed a way to byte compile and then encrypt Python byte code for plug-ins, to meet a requirement from some third party partner.

This was long enough ago that it was in the Python 2 days, so I don't know if the method survived the product's transition to Python 3. I do know the method would probably not have survived a dedicated reverse engineer who wanted to figure out how to recover the unencrypted bytecode.