mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)
This commit is contained in:
parent
5e8c691594
commit
8852ad4208
9 changed files with 35 additions and 26 deletions
|
@ -785,6 +785,8 @@ is_internal_frame(PyFrameObject *frame)
|
|||
|
||||
PyCodeObject *code = PyFrame_GetCode(frame);
|
||||
PyObject *filename = code->co_filename;
|
||||
Py_DECREF(code);
|
||||
|
||||
if (filename == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -850,7 +852,9 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
|
|||
}
|
||||
else {
|
||||
globals = f->f_globals;
|
||||
*filename = PyFrame_GetCode(f)->co_filename;
|
||||
PyCodeObject *code = PyFrame_GetCode(f);
|
||||
*filename = code->co_filename;
|
||||
Py_DECREF(code);
|
||||
Py_INCREF(*filename);
|
||||
*lineno = PyFrame_GetLineNumber(f);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue