Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f17c3de

Browse files
committed
Use _PyObject_CallNoArg()
Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable)
1 parent a5ed5f0 commit f17c3de

15 files changed

Lines changed: 21 additions & 21 deletions

Modules/_asynciomodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
19481948

19491949
if (!exc) {
19501950
/* exc was not a CancelledError */
1951-
exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
1951+
exc = _PyObject_CallNoArg(asyncio_CancelledError);
19521952
if (!exc) {
19531953
goto fail;
19541954
}

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5258,7 +5258,7 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
52585258
CDataObject *result;
52595259
if (0 == cast_check_pointertype(ctype))
52605260
return NULL;
5261-
result = (CDataObject *)PyObject_CallFunctionObjArgs(ctype, NULL);
5261+
result = (CDataObject *)_PyObject_CallNoArg(ctype);
52625262
if (result == NULL)
52635263
return NULL;
52645264

Modules/_ctypes/callbacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void _CallPythonObject(void *mem,
181181
*/
182182
} else if (dict) {
183183
/* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */
184-
CDataObject *obj = (CDataObject *)PyObject_CallFunctionObjArgs(cnv, NULL);
184+
CDataObject *obj = (CDataObject *)_PyObject_CallNoArg(cnv);
185185
if (!obj) {
186186
PrintError("create argument %d:\n", i);
187187
Py_DECREF(cnv);

Modules/_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
31973197
PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
31983198

31993199
if (pw_info->callable) {
3200-
fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL);
3200+
fn_ret = _PyObject_CallNoArg(pw_info->callable);
32013201
if (!fn_ret) {
32023202
/* TODO: It would be nice to move _ctypes_add_traceback() into the
32033203
core python API, so we could use it to add a frame here */

Modules/mathmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
951951
return NULL;
952952
return math_1_to_int(number, ceil, 0);
953953
}
954-
result = PyObject_CallFunctionObjArgs(method, NULL);
954+
result = _PyObject_CallNoArg(method);
955955
Py_DECREF(method);
956956
return result;
957957
}
@@ -991,7 +991,7 @@ static PyObject * math_floor(PyObject *self, PyObject *number) {
991991
return NULL;
992992
return math_1_to_int(number, floor, 0);
993993
}
994-
result = PyObject_CallFunctionObjArgs(method, NULL);
994+
result = _PyObject_CallNoArg(method);
995995
Py_DECREF(method);
996996
return result;
997997
}
@@ -1542,7 +1542,7 @@ math_trunc(PyObject *self, PyObject *number)
15421542
Py_TYPE(number)->tp_name);
15431543
return NULL;
15441544
}
1545-
result = PyObject_CallFunctionObjArgs(trunc, NULL);
1545+
result = _PyObject_CallNoArg(trunc);
15461546
Py_DECREF(trunc);
15471547
return result;
15481548
}

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ path_converter(PyObject *o, void *p)
902902
goto error_exit;
903903
}
904904

905-
o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL);
905+
o = to_cleanup = _PyObject_CallNoArg(func);
906906
Py_DECREF(func);
907907
if (NULL == o) {
908908
goto error_exit;
@@ -12046,7 +12046,7 @@ PyOS_FSPath(PyObject *path)
1204612046
Py_TYPE(path)->tp_name);
1204712047
}
1204812048

12049-
path_repr = PyObject_CallFunctionObjArgs(func, NULL);
12049+
path_repr = _PyObject_CallNoArg(func);
1205012050
Py_DECREF(func);
1205112051
if (NULL == path_repr) {
1205212052
return NULL;

Objects/abstract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
103103
}
104104
return defaultvalue;
105105
}
106-
result = PyObject_CallFunctionObjArgs(hint, NULL);
106+
result = _PyObject_CallNoArg(hint);
107107
Py_DECREF(hint);
108108
if (result == NULL) {
109109
if (PyErr_ExceptionMatches(PyExc_TypeError)) {

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
549549
/* does it support __bytes__? */
550550
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
551551
if (func != NULL) {
552-
result = PyObject_CallFunctionObjArgs(func, NULL);
552+
result = _PyObject_CallNoArg(func);
553553
Py_DECREF(func);
554554
if (result == NULL)
555555
return NULL;
@@ -2569,7 +2569,7 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
25692569
PyObject_Bytes doesn't do. */
25702570
func = _PyObject_LookupSpecial(x, &PyId___bytes__);
25712571
if (func != NULL) {
2572-
new = PyObject_CallFunctionObjArgs(func, NULL);
2572+
new = _PyObject_CallNoArg(func);
25732573
Py_DECREF(func);
25742574
if (new == NULL)
25752575
return NULL;

Objects/complexobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ try_complex_special_method(PyObject *op) {
273273

274274
f = _PyObject_LookupSpecial(op, &PyId___complex__);
275275
if (f) {
276-
PyObject *res = PyObject_CallFunctionObjArgs(f, NULL);
276+
PyObject *res = _PyObject_CallNoArg(f);
277277
Py_DECREF(f);
278278
if (res != NULL && !PyComplex_Check(res)) {
279279
PyErr_SetString(PyExc_TypeError,

Objects/enumobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
258258
return NULL;
259259
}
260260
if (reversed_meth != NULL) {
261-
PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL);
261+
PyObject *res = _PyObject_CallNoArg(reversed_meth);
262262
Py_DECREF(reversed_meth);
263263
return res;
264264
}

0 commit comments

Comments
 (0)