diff options
Diffstat (limited to 'Modules/readline.c')
-rw-r--r-- | Modules/readline.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 63be9b4..27459d0 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -323,10 +323,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, @@ -828,7 +826,7 @@ on_hook(PyObject *func) if (r == Py_None) result = 0; else { - result = PyLong_AsLong(r); + result = _PyLong_AsInt(r); if (result == -1 && PyErr_Occurred()) goto error; } |