how to get the last interactive command enetered

Tom NoSpam at NoSpam.com
Sat Mar 3 11:38:00 EST 2001


"Martin von Loewis" <loewis at informatik.hu-berlin.de> wrote in message
news:j4bsrjxjy3.fsf at informatik.hu-berlin.de...
> "Tom" <NoSpam at NoSpam.com> writes:
>
> > For example, say that I set a trace function.  I find the frame's code
> > object, look at co_filename and find that it is <stdin>.  But I want to
know
> > what the actual command was.  Is there anyway to do this (in C or
Python)?
>
> No. Once the code is executed, the source code is dropped. All you can
> get at is the binary code.

But when I catch a 'call' trace event the code has not been executed.  I
believe that it has been parsed and compiled but not executed (till I get
the 'return' trace event).

> Of course, "in C", you can rewrite the Python interpreter to behave
> differently. It takes more than an extension module to do so, though.

I am avoiding changing python itself.  I want to do this from 'the outside'.

Thanks for your response,

Tom.
> Regards,
> Martin
>





More information about the Python-list mailing list