diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-05 21:27:54 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-05 21:27:54 +0200 |
commit | 576f132b986b5ee60e4b84d34a519a5edcd8c03e (patch) | |
tree | f048292ddc0b5c3d6a5afc50dc2cd4b28372c655 /Modules/readline.c | |
parent | dcf76c9d0ab11f77eaa856ff0583c5c636ddb47d (diff) | |
download | cpython-git-576f132b986b5ee60e4b84d34a519a5edcd8c03e.tar.gz |
Issue #20440: Cleaning up the code by using Py_SETREF.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r-- | Modules/readline.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 939ff1ad55..69304154b1 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, |