Re: finding out the call (and not only the caller)



Hi Neal,

nnorwitz@xxxxxxxxx wrote:
The code doesn't handle all the cases (e.g., nested functions), but
gives you an idea of what can be done and where to look for the info
(ie, in the stack frame and how to parse the byte codes to some
extent). For nested functions, look in co_consts.

Bytecodes are specific to CPython. This code won't work on
IronPython, Jython, or PyPy. This code really shouldn't be used for
production. However, it demonstrates some of the info available.

Actually that's not true for PyPy. PyPy uses CPython's bytecode, so the example works just fine.

Cheers,

Carl Friedrich Bolz

.



Relevant Pages

  • Re: pyvm -- faster python
    ... >> pypy needs to boost its performance. ... Does pypy have a compiler that produces 2.4 bytecodes? ... >Pypy makes native machine code, ...
    (comp.lang.python)
  • Re: pyvm -- faster python
    ... > pypy needs to boost its performance. ... Does pypy has the vm in python ... Does pypy have a compiler that produces 2.4 bytecodes? ...
    (comp.lang.python)