diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:46:20 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:46:20 (GMT) |
commit | dfe98a102ec8723d750f78ecda08a7adb9360eb1 (patch) | |
tree | f8aea8fb3d74be18ed67a2f4e0a355ad9beb42d8 /Modules/readline.c | |
parent | 2623c8c23cead505a78ec416072223552e94727e (diff) | |
parent | 505ff755d704c73ac613d3e8fed02c79c6ae555a (diff) | |
download | cpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.zip cpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.tar.gz cpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.tar.bz2 |
Issue #20437: Fixed 22 potential bugs when deleting objects references.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r-- | Modules/readline.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 0be39da..4bba0db 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -281,8 +281,7 @@ set_hook(const char *funcname, PyObject **hook_var, PyObject *args) if (!PyArg_ParseTuple(args, buf, &function)) return NULL; if (function == Py_None) { - Py_XDECREF(*hook_var); - *hook_var = NULL; + Py_CLEAR(*hook_var); } else if (PyCallable_Check(function)) { PyObject *tmp = *hook_var; @@ -885,7 +884,7 @@ on_completion_display_matches_hook(char **matches, (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) { goto error; } - Py_XDECREF(r); r=NULL; + Py_CLEAR(r); if (0) { error: |