diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:14:04 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:14:04 (GMT) |
commit | 98a9722e4a82b5f7dc0411233bbec892a02c7667 (patch) | |
tree | 51179bb7d80e822a18d0ccbb41fde7198f424813 /Python | |
parent | 2cfae9b03f706e0d6889dfecc21f87419d926b00 (diff) | |
download | cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.zip cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.gz cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.bz2 |
Issue #20437: Fixed 43 potential bugs when deleting objects references.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 3 | ||||
-rw-r--r-- | Python/sysmodule.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 06ada97..18bc66b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3240,8 +3240,7 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, if (co->co_flags & CO_GENERATOR) { /* Don't need to keep the reference to f_back, it will be set * when the generator is resumed. */ - Py_XDECREF(f->f_back); - f->f_back = NULL; + Py_CLEAR(f->f_back); PCALL(PCALL_GENERATOR); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 2c364af..560ea4e 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -367,8 +367,7 @@ trace_trampoline(PyObject *self, PyFrameObject *frame, result = call_trampoline(tstate, callback, frame, what, arg); if (result == NULL) { PyEval_SetTrace(NULL, NULL); - Py_XDECREF(frame->f_trace); - frame->f_trace = NULL; + Py_CLEAR(frame->f_trace); return -1; } if (result != Py_None) { |