How to get the python sourcecode line, when debuging the Python C sources?
Owen F. Ransen
ransen at nemo.it
Wed Sep 8 10:36:24 EDT 1999
On 8 Sep 1999 00:49:22 GMT, aahz at netcom.com (Aahz Maruch) wrote:
>In article <7r4alh$7gl$1 at m2.c2.telstra-mm.net.au>,
>Mark Hammond <MHammond at skippinet.com.au> wrote:
>>Stefan Knappmann <101.139915 at germanynet.de> wrote in message
>>>
>>>Does anybody know in which C variable I can find the Python Stack?
>>>Or how to get the activ Python source code line from within the C
>>>debugger?
>>
>>Move down the stack to eval2() in ceval.c. f->f_lineno will tell you the
>>line number. f->f_code->co_filename + 20 bytes is the start of the ASCII
>>string containing the filename. Adding something like "(char *)(((char
>>*)f->f_code->co_filename))+20)" to the watch window should do the trick.
>
>And people wonder why I think C is a dead language.
Ah but it is not! It is alive and well in tons of tiny micros
around your house and in your car and in your cell phone and
in your video recorder and...
Anyway when I first looked at Python it made as much sense to
me as what that C code does to you. We just have to get used
to different languages....
--------------------------------------------------
Owen F Ransen ransen at nemo.it
http://www.ransen.com the home of Repligator
Winner SIAF awards - Best Graphics Program of 1999
More information about the Python-list
mailing list