Issue #20440: Cleaning up the code by using Py_SETREF.

This commit is contained in:
Serhiy Storchaka 2016-01-05 21:27:54 +02:00
parent dcf76c9d0a
commit 576f132b98
14 changed files with 39 additions and 120 deletions

View file

@ -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,