access pythons code object directly rather than attribute access.

This commit is contained in:
Campbell Barton
2011-05-29 11:05:52 +00:00
parent ebdca474b5
commit 11014aa34b
4 changed files with 4 additions and 19 deletions

View File

@@ -1198,14 +1198,13 @@ void PyDebugLine()
f_lineno= PyObject_GetAttrString(frame, "f_lineno");
f_code= PyObject_GetAttrString(frame, "f_code");
if (f_lineno && f_code) {
co_filename= PyObject_GetAttrString(f_code, "co_filename");
co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */
if (co_filename) {
printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
Py_DECREF(f_lineno);
Py_DECREF(f_code);
Py_DECREF(co_filename);
Py_DECREF(frame);
return;
}