Issue #20041: Fixed TypeError when frame.f_trace is set to None.

Patch by Xavier de Gaye.
This commit is contained in:
Serhiy Storchaka 2016-06-04 20:33:33 +03:00
commit 64c26e5f60
3 changed files with 14 additions and 0 deletions

View file

@ -344,6 +344,8 @@ frame_settrace(PyFrameObject *f, PyObject* v, void *closure)
/* We rely on f_lineno being accurate when f_trace is set. */
f->f_lineno = PyFrame_GetLineNumber(f);
if (v == Py_None)
v = NULL;
Py_XINCREF(v);
Py_XSETREF(f->f_trace, v);