[Python-Dev] API bloat
Victor Stinner
victor.stinner at haypocalc.com
Thu Feb 10 22:57:39 CET 2011
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
More information about the Python-Dev
mailing list