Skip to content

Commit ef3ef20

Browse files
authored
Merge pull request #3020 from Starbuck5/use-callnoargs
Use PyObject_CallNoArgs where applicable
2 parents cd4826f + da19260 commit ef3ef20

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src_c/base.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pg_mod_autoinit(const char *modname)
270270
}
271271

272272
if (funcobj) {
273-
temp = PyObject_CallObject(funcobj, NULL);
273+
temp = PyObject_CallNoArgs(funcobj);
274274
if (temp) {
275275
Py_DECREF(temp);
276276
ret = 1;
@@ -305,7 +305,7 @@ pg_mod_autoquit(const char *modname)
305305
PyErr_Clear();
306306

307307
if (funcobj) {
308-
temp = PyObject_CallObject(funcobj, NULL);
308+
temp = PyObject_CallNoArgs(funcobj);
309309
Py_XDECREF(temp);
310310
}
311311

@@ -429,7 +429,7 @@ _pg_quit(void)
429429
}
430430

431431
if (PyCallable_Check(quit)) {
432-
temp = PyObject_CallObject(quit, NULL);
432+
temp = PyObject_CallNoArgs(quit);
433433
if (temp)
434434
Py_DECREF(temp);
435435
else

src_c/geometry_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pgCircle_FromObject(PyObject *obj, pgCircleBase *out)
108108

109109
if (PyCallable_Check(circleattr)) /*call if it's a method*/
110110
{
111-
PyObject *circleresult = PyObject_CallObject(circleattr, NULL);
111+
PyObject *circleresult = PyObject_CallNoArgs(circleattr);
112112
Py_DECREF(circleattr);
113113
if (!circleresult) {
114114
PyErr_Clear();

src_c/rect_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ RectExport_RectFromObject(PyObject *obj, InnerRect *temp)
748748
InnerRect *returnrect;
749749
/*call if it's a method*/
750750
if (PyCallable_Check(rectattr)) {
751-
PyObject *rectresult = PyObject_CallObject(rectattr, NULL);
751+
PyObject *rectresult = PyObject_CallNoArgs(rectattr);
752752
Py_DECREF(rectattr);
753753
if (rectresult == NULL) {
754754
PyErr_Clear();

src_c/rwobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ _pg_rw_size(SDL_RWops *context)
310310

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

328328
/* Record file size.
329329
*/
330-
tmp = PyObject_CallFunction(helper->tell, NULL);
330+
tmp = PyObject_CallNoArgs(helper->tell);
331331
if (!tmp) {
332332
PyErr_Print();
333333
goto end;
@@ -398,7 +398,7 @@ _pg_rw_close(SDL_RWops *context)
398398
PyGILState_STATE state = PyGILState_Ensure();
399399

400400
if (helper->close) {
401-
result = PyObject_CallFunction(helper->close, NULL);
401+
result = PyObject_CallNoArgs(helper->close);
402402
if (!result) {
403403
PyErr_Print();
404404
retval = -1;
@@ -479,7 +479,7 @@ _pg_rw_seek(SDL_RWops *context, Sint64 offset, int whence)
479479
Py_DECREF(result);
480480
}
481481

482-
result = PyObject_CallFunction(helper->tell, NULL);
482+
result = PyObject_CallNoArgs(helper->tell);
483483
if (!result) {
484484
PyErr_Print();
485485
retval = -1;

0 commit comments

Comments
 (0)