mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Issue #20041: Fixed TypeError when frame.f_trace is set to None.
Patch by Xavier de Gaye.
This commit is contained in:
parent
89beb27061
commit
64a263a1ce
3 changed files with 15 additions and 5 deletions
|
@ -349,15 +349,13 @@ frame_gettrace(PyFrameObject *f, void *closure)
|
|||
static int
|
||||
frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
|
||||
{
|
||||
PyObject* old_value;
|
||||
|
||||
/* We rely on f_lineno being accurate when f_trace is set. */
|
||||
f->f_lineno = PyFrame_GetLineNumber(f);
|
||||
|
||||
old_value = f->f_trace;
|
||||
if (v == Py_None)
|
||||
v = NULL;
|
||||
Py_XINCREF(v);
|
||||
f->f_trace = v;
|
||||
Py_XDECREF(old_value);
|
||||
Py_XSETREF(f->f_trace, v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue