summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-04 17:32:36 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-04 17:32:36 (GMT)
commit64a263a1ceed726494767d833a2ea33033a6ae28 (patch)
treeb8a2339ab7c3da9cd0e71694f313ccfcbb631475 /Objects
parent89beb27061178e3cdb2d249b3719e4f35234db48 (diff)
downloadcpython-64a263a1ceed726494767d833a2ea33033a6ae28.zip
cpython-64a263a1ceed726494767d833a2ea33033a6ae28.tar.gz
cpython-64a263a1ceed726494767d833a2ea33033a6ae28.tar.bz2
Issue #20041: Fixed TypeError when frame.f_trace is set to None.
Patch by Xavier de Gaye.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index bdf06db..9aadd61 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -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;
}