summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-01-05 19:27:54 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-01-05 19:27:54 (GMT)
commit576f132b986b5ee60e4b84d34a519a5edcd8c03e (patch)
treef048292ddc0b5c3d6a5afc50dc2cd4b28372c655 /Modules/readline.c
parentdcf76c9d0ab11f77eaa856ff0583c5c636ddb47d (diff)
downloadcpython-576f132b986b5ee60e4b84d34a519a5edcd8c03e.zip
cpython-576f132b986b5ee60e4b84d34a519a5edcd8c03e.tar.gz
cpython-576f132b986b5ee60e4b84d34a519a5edcd8c03e.tar.bz2
Issue #20440: Cleaning up the code by using Py_SETREF.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 939ff1a..6930415 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -321,10 +321,8 @@ set_hook(const char *funcname, PyObject **hook_var, PyObject *args)
Py_CLEAR(*hook_var);
}
else if (PyCallable_Check(function)) {
- PyObject *tmp = *hook_var;
Py_INCREF(function);
- *hook_var = function;
- Py_XDECREF(tmp);
+ Py_SETREF(*hook_var, function);
}
else {
PyErr_Format(PyExc_TypeError,