summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:33:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:33:53 (GMT)
commit505ff755d704c73ac613d3e8fed02c79c6ae555a (patch)
treeb9b0142cbeca125a1bcf0413e48d938d0cd390d3 /Modules/readline.c
parente9c31470e1680b7c9b9ee83c378b891e90ac58ab (diff)
downloadcpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.zip
cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.gz
cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.bz2
Issue #20437: Fixed 21 potential bugs when deleting objects references.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index bcd34f7..8fac526 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -231,8 +231,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;
@@ -827,7 +826,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: