This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients ezio.melotti, georg.brandl, lesmana, ncoghlan, petri.lehtinen, psss
Date 2011-10-03.10:49:34
SpamBayes Score 3.6199406e-08
Marked as misclassified No
Message-id <>
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;
        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:35ezio.melottisetrecipients: + ezio.melotti, georg.brandl, ncoghlan, psss, lesmana, petri.lehtinen
2011-10-03 10:49:35ezio.melottisetmessageid: <>
2011-10-03 10:49:34ezio.melottilinkissue12458 messages
2011-10-03 10:49:34ezio.melotticreate