incorrect line reported in traceback

  • Thread starter Patrick Stinson
  • Start date
P

Patrick Stinson

Is there any reason why the last item in the traceback is one frame
below the top of the stack? It would be great to show the real line in
my editor...
 
J

John Machin

Is there any reason why the last item in the traceback is one frame
below the top of the stack? It would be great to show the real line in
my editor...

Maybe your anonymous [HINT!] editor is confused. Do you get the same
problem when you run your script at the shell prompt?
 
P

Patrick Stinson

No, I've embedded the interpreter and an editor in my app, which might
have something to do with it. I can't run the scripts at the command
line because my app provides an API to built-ins that isn't availbel
in the standard interpreter. I am simply calling a python method in
the script module using PyObject_CallObject(), and fetching the
traceback using PyErr_Fetch() and PyErr_Normalize(), like this:

PyObject *type, *value, *traceback;

PyErr_Fetch(&type, &value, &traceback);
PyErr_NormalizeException(&type, &value, &traceback);

if(traceback) // traceback.tb_lineno
*lineno = ((PyTracebackObject *) traceback)->tb_lineno;

Is there any reason why the last item in the traceback is one frame
below the top of the stack? It would be great to show the real line in
my editor...

Maybe your anonymous [HINT!] editor is confused. Do you get the same
problem when you run your script at the shell prompt?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top