I wrote my own assembler for Python bytecode called "Maynard".  I had to statically compute the stack effects for each bytecode instruction by hand; what I did was copied and pasted opcode_stack_effect() (which is static) out of Python/compile.c and into my own driver program, then I probed it with test values to produce a table.  I then coded up a function using that table, but hand-calculating the value sometimes as there are some opcodes whose stack effect varies based on the oparg.

It sure would be nice if this information was simply available to the Python interpreter; theoretically it can change between point releases.  Would anybody mind if I added it somewhere?  I'd probably just expose opcode_stack_effect to Python, then add all this other junk to the dis module and make it available there.


/arry