diff options
-rw-r--r-- | Python/traceback.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index b627b06..fdaf19d 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -111,7 +111,10 @@ static int tb_get_lineno(PyTracebackObject* tb) { PyFrameObject* frame = tb->tb_frame; assert(frame != NULL); - return PyCode_Addr2Line(PyFrame_GetCode(frame), tb->tb_lasti); + PyCodeObject *code = PyFrame_GetCode(frame); + int lineno = PyCode_Addr2Line(code, tb->tb_lasti); + Py_DECREF(code); + return lineno; } static PyObject * |