Byte code descriptions somewhere?

Ned Batchelder ned at nedbatchelder.com
Sat Oct 1 20:30:07 EDT 2016


On Saturday, October 1, 2016 at 7:48:09 PM UTC-4, Cem Karan wrote:
> Cool, thank you!  Quick experimentation suggests that I don't need to worry about marking anything for garbage collection, correct?  The next question is, how do I create a stream of byte codes that can be interpreted by CPython directly?  I don't mean 'use the compile module', I mean writing my own byte array with bytes that CPython can directly interpret.

In Python 2, you use new.code: https://docs.python.org/2/library/new.html#new.code  It takes a bytestring of byte codes as one of its
twelve (!) arguments.

Something that might help (indirectly) with understanding bytecode:
byterun (https://github.com/nedbat/byterun) is a pure-Python implementation
of a Python bytecode VM.

--Ned.



More information about the Python-list mailing list