summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapi/watchers.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_testcapi/watchers.c')
-rw-r--r--Modules/_testcapi/watchers.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/Modules/_testcapi/watchers.c b/Modules/_testcapi/watchers.c
index 7167943..4cf567b 100644
--- a/Modules/_testcapi/watchers.c
+++ b/Modules/_testcapi/watchers.c
@@ -516,13 +516,7 @@ static PyFunction_WatchCallback func_watcher_callbacks[NUM_TEST_FUNC_WATCHERS] =
static int
add_func_event(PyObject *module, const char *name, PyFunction_WatchEvent event)
{
- PyObject *value = PyLong_FromLong(event);
- if (value == NULL) {
- return -1;
- }
- int ok = PyModule_AddObjectRef(module, name, value);
- Py_DECREF(value);
- return ok;
+ return PyModule_Add(module, name, PyLong_FromLong(event));
}
static PyObject *