On Thu, Oct 24, 2019, 9:05 PM Yonatan Zunger firstname.lastname@example.org wrote:
Has anyone already done this that people know of? (Searching the Internetz didn't turn anything up) Failing that, to what extent is it reasonable to either consider assemble() as some kind of sane API point into compile.c, and/or add some new API in compile.h which implements all of the stuff described above in C?
(I'm fully expecting the answer to these latter questions to be "you have got to be kidding me," but figured it was wiser to check than to reinvent this particular wheel if it isn't necessary)
There is byteplay (https://github.com/tallforasmurf/byteplay), but it is broken on Python 3.6+ due to the change to wordcode. There is also a newer one called simply "bytecode" (https://github.com/vstinner/bytecode) that appears to work through at least 3.7 (though I haven't personally tried it.