mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
[3.11] [3.12] gh-109181: Fix refleak in tb_get_lineno() (GH-111948) (#111951)
[3.12] gh-109181: Fix refleak in tb_get_lineno() (GH-111948)
PyFrame_GetCode() returns a strong reference.
(cherry picked from commit 4b0c875d91
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
7b8445109d
commit
8222ad01fe
1 changed files with 4 additions and 1 deletions
|
@ -115,7 +115,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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue