Skip to content

Commit

Permalink
Use NULL for zero-argument PyObject_CallMethod format (#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson authored May 19, 2020
1 parent 486a289 commit 928caa7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions traits/ctraits.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,10 @@ has_traits_init(PyObject *obj, PyObject *args, PyObject *kwds)
(PyMapping_Size(PyDict_GetItem(Py_TYPE(obj)->tp_dict, listener_traits))
> 0);
if (has_listeners) {
value = PyObject_CallMethod(obj, "_init_trait_listeners", "()");
value = PyObject_CallMethod(obj, "_init_trait_listeners", NULL);
if (value == NULL) {
return -1;
}

Py_DECREF(value);
}

Expand All @@ -755,11 +754,10 @@ has_traits_init(PyObject *obj, PyObject *args, PyObject *kwds)
/* Make sure all post constructor argument assignment listeners have been
set up: */
if (has_listeners) {
value = PyObject_CallMethod(obj, "_post_init_trait_listeners", "()");
value = PyObject_CallMethod(obj, "_post_init_trait_listeners", NULL);
if (value == NULL) {
return -1;
}

Py_DECREF(value);
}

Expand All @@ -772,11 +770,10 @@ has_traits_init(PyObject *obj, PyObject *args, PyObject *kwds)
Py_DECREF(value);

/* Call the 'traits_init' method to finish up initialization: */
value = PyObject_CallMethod(obj, "traits_init", "()");
value = PyObject_CallMethod(obj, "traits_init", NULL);
if (value == NULL) {
return -1;
}

Py_DECREF(value);

/* Indicate that the object has finished being initialized: */
Expand Down

0 comments on commit 928caa7

Please sign in to comment.