Le jeudi 10 février 2011 à 17:25 +0000, Mark Shannon a écrit :
> What about this one then,
> 
> PyFrame_GetLineNumber was added because people were using 
> PyCode_Addr2Line to get the current line number.
> 
> The API will contain then both
> PyFrame_GetLineNumber *and* PyCode_Addr2Line.
> The API then has even more redundancy.
> 
> PyObject_GetAttrString(frame, "f_lineno") should do the job.

Not exactly:

int
PyFrame_GetLineNumber(PyFrameObject *f)
{
    if (f->f_trace)
        return f->f_lineno;
    else
        return PyCode_Addr2Line(f->f_code, f->f_lasti);
}

Victor

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to