Newbie question - Getting current line number in embedded python
Guido Piasenza
g.piasenza at fidia.it
Mon Sep 4 04:46:06 EDT 2000
Hi folks,
I tried to lookup this topic in the mailing list archives,
but found nothing.
I am currently evaluating different scripting languages to
embed in a plc-like application. So far embedded python
looks very promising, but I have a problem: once I call
PyEval_EvalCode on a precompiled code object (created through
PyNode_Compile) I would like to know what line number
of my source file is being executed (in a different thread,
of course).
I browsed the source code of the executor and found that
there is an endless loop (in eval_code2) which extracts
opcodes and executes them, so I think this would be a
nice place to wedge some code to extract this information.
However, I found no way to get the "current line number"
from the code block. I still have the parse tree and the
compiled block stored in my application... do I have any
way to map the offset of the current instruction to the
node which previously generated it during the compilation
phase ? Or any other way to extract the current line number ?
Any help really appreciated.
Ciao,
Guido
More information about the Python-list
mailing list