mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
[3.12] gh-109181: Fix refleak in tb_get_lineno() (#111948)
PyFrame_GetCode() returns a strong reference.
This commit is contained in:
parent
881c9eb962
commit
4b0c875d91
1 changed files with 4 additions and 1 deletions
|
@ -111,7 +111,10 @@ static int
|
||||||
tb_get_lineno(PyTracebackObject* tb) {
|
tb_get_lineno(PyTracebackObject* tb) {
|
||||||
PyFrameObject* frame = tb->tb_frame;
|
PyFrameObject* frame = tb->tb_frame;
|
||||||
assert(frame != NULL);
|
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 *
|
static PyObject *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue