Skip to content

Commit

Permalink
Use PyObject_CallOneArg where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Aug 21, 2024
1 parent 141a75d commit 0020f72
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src_c/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ MODINIT_DEFINE(base)
if (!quit) { /* assertion */
goto error;
}
rval = PyObject_CallFunctionObjArgs(atexit_register, quit, NULL);
rval = PyObject_CallOneArg(atexit_register, quit);
Py_DECREF(atexit_register);
Py_DECREF(quit);
atexit_register = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src_c/bufferproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ _get_buffer_from_dict(PyObject *dict, Py_buffer *view_p, int flags)
PyObject *py_rval;

Py_INCREF(py_callback);
py_rval = PyObject_CallFunctionObjArgs(py_callback, obj, NULL);
py_rval = PyObject_CallOneArg(py_callback, obj);
Py_DECREF(py_callback);
if (!py_rval) {
pgBuffer_Release(pg_dict_view_p);
Expand Down Expand Up @@ -153,7 +153,7 @@ _release_buffer_from_dict(Py_buffer *view_p)
PyObject *py_rval;

Py_INCREF(py_callback);
py_rval = PyObject_CallFunctionObjArgs(py_callback, obj, NULL);
py_rval = PyObject_CallOneArg(py_callback, obj);
if (py_rval) {
Py_DECREF(py_rval);
}
Expand Down
12 changes: 6 additions & 6 deletions src_c/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ key_get_pressed(PyObject *self, PyObject *_null)
PyTuple_SET_ITEM(key_tuple, i, key_elem);
}

ret_obj = PyObject_CallFunctionObjArgs((PyObject *)&pgScancodeWrapper_Type,
key_tuple, NULL);
ret_obj =
PyObject_CallOneArg((PyObject *)&pgScancodeWrapper_Type, key_tuple);
Py_DECREF(key_tuple);
return ret_obj;
}
Expand All @@ -216,8 +216,8 @@ get_just_pressed(PyObject *self, PyObject *_null)
}
PyTuple_SET_ITEM(key_tuple, i, key_elem);
}
ret_obj = PyObject_CallFunctionObjArgs((PyObject *)&pgScancodeWrapper_Type,
key_tuple, NULL);
ret_obj =
PyObject_CallOneArg((PyObject *)&pgScancodeWrapper_Type, key_tuple);
Py_DECREF(key_tuple);
return ret_obj;
}
Expand All @@ -244,8 +244,8 @@ get_just_released(PyObject *self, PyObject *_null)
}
PyTuple_SET_ITEM(key_tuple, i, key_elem);
}
ret_obj = PyObject_CallFunctionObjArgs((PyObject *)&pgScancodeWrapper_Type,
key_tuple, NULL);
ret_obj =
PyObject_CallOneArg((PyObject *)&pgScancodeWrapper_Type, key_tuple);
Py_DECREF(key_tuple);
return ret_obj;
}
Expand Down
3 changes: 1 addition & 2 deletions src_c/rect_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1529,8 +1529,7 @@ RectExport_RectFromObjectAndKeyFunc(PyObject *obj, PyObject *keyfunc,
InnerRect *temp)
{
if (keyfunc) {
PyObject *obj_with_rect = PyObject_Vectorcall(keyfunc, &obj, 1, NULL);

PyObject *obj_with_rect = PyObject_CallOneArg(keyfunc, obj);
if (!obj_with_rect) {
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src_c/rwobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ _pg_rw_size(SDL_RWops *context)

/* Return to original position.
*/
tmp = PyObject_CallFunctionObjArgs(helper->seek, pos, NULL);
tmp = PyObject_CallOneArg(helper->seek, pos);
if (!tmp) {
PyErr_Print();
goto end;
Expand Down

0 comments on commit 0020f72

Please sign in to comment.