Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PyObject_CallNoArgs where applicable #3020

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src_c/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pg_mod_autoinit(const char *modname)
}

if (funcobj) {
temp = PyObject_CallObject(funcobj, NULL);
temp = PyObject_CallNoArgs(funcobj);
if (temp) {
Py_DECREF(temp);
ret = 1;
Expand Down Expand Up @@ -305,7 +305,7 @@ pg_mod_autoquit(const char *modname)
PyErr_Clear();

if (funcobj) {
temp = PyObject_CallObject(funcobj, NULL);
temp = PyObject_CallNoArgs(funcobj);
Py_XDECREF(temp);
}

Expand Down Expand Up @@ -429,7 +429,7 @@ _pg_quit(void)
}

if (PyCallable_Check(quit)) {
temp = PyObject_CallObject(quit, NULL);
temp = PyObject_CallNoArgs(quit);
if (temp)
Py_DECREF(temp);
else
Expand Down
2 changes: 1 addition & 1 deletion src_c/geometry_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pgCircle_FromObject(PyObject *obj, pgCircleBase *out)

if (PyCallable_Check(circleattr)) /*call if it's a method*/
{
PyObject *circleresult = PyObject_CallObject(circleattr, NULL);
PyObject *circleresult = PyObject_CallNoArgs(circleattr);
Py_DECREF(circleattr);
if (!circleresult) {
PyErr_Clear();
Expand Down
2 changes: 1 addition & 1 deletion src_c/rect_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ RectExport_RectFromObject(PyObject *obj, InnerRect *temp)
InnerRect *returnrect;
/*call if it's a method*/
if (PyCallable_Check(rectattr)) {
PyObject *rectresult = PyObject_CallObject(rectattr, NULL);
PyObject *rectresult = PyObject_CallNoArgs(rectattr);
Py_DECREF(rectattr);
if (rectresult == NULL) {
PyErr_Clear();
Expand Down
8 changes: 4 additions & 4 deletions src_c/rwobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ _pg_rw_size(SDL_RWops *context)

/* Current file position; need to restore it later.
*/
pos = PyObject_CallFunction(helper->tell, NULL);
pos = PyObject_CallNoArgs(helper->tell);
if (!pos) {
PyErr_Print();
goto end;
Expand All @@ -327,7 +327,7 @@ _pg_rw_size(SDL_RWops *context)

/* Record file size.
*/
tmp = PyObject_CallFunction(helper->tell, NULL);
tmp = PyObject_CallNoArgs(helper->tell);
if (!tmp) {
PyErr_Print();
goto end;
Expand Down Expand Up @@ -398,7 +398,7 @@ _pg_rw_close(SDL_RWops *context)
PyGILState_STATE state = PyGILState_Ensure();

if (helper->close) {
result = PyObject_CallFunction(helper->close, NULL);
result = PyObject_CallNoArgs(helper->close);
if (!result) {
PyErr_Print();
retval = -1;
Expand Down Expand Up @@ -479,7 +479,7 @@ _pg_rw_seek(SDL_RWops *context, Sint64 offset, int whence)
Py_DECREF(result);
}

result = PyObject_CallFunction(helper->tell, NULL);
result = PyObject_CallNoArgs(helper->tell);
if (!result) {
PyErr_Print();
retval = -1;
Expand Down
Loading