Message144813
This is an interesting proposal.
The line number comes from Python/traceback.c:120:
tb->tb_lineno = PyFrame_GetLineNumber(frame);
and this function is defined in Objects/frameobject.c:35:
int PyFrame_GetLineNumber(PyFrameObject *f) {
if (f->f_trace)
return f->f_lineno;
else
return PyCode_Addr2Line(f->f_code, f->f_lasti);
}
and documented as "Return the line number that frame is currently executing.", so that would explain why it's pointing to the last line.
I'm not sure if there's an easy way to get the line where the beginning of the expression is, but if you find a way to get it, we could try to use it in PyFrame_GetLineNumber and see how it works. |
|
Date |
User |
Action |
Args |
2011-10-03 10:49:35 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, ncoghlan, psss, lesmana, petri.lehtinen |
2011-10-03 10:49:35 | ezio.melotti | set | messageid: <1317638975.4.0.223337846609.issue12458@psf.upfronthosting.co.za> |
2011-10-03 10:49:34 | ezio.melotti | link | issue12458 messages |
2011-10-03 10:49:34 | ezio.melotti | create | |
|