Skip to content

Commit ce3489c

Browse files
authored
bpo-45439: Rename _PyObject_CallNoArg() to _PyObject_CallNoArgs() (GH-28891)
Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
1 parent fb8f208 commit ce3489c

37 files changed

+73
-73
lines changed

Include/cpython/abstract.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
164164
Private static inline function variant of public function
165165
PyObject_CallNoArgs(). */
166166
static inline PyObject *
167-
_PyObject_CallNoArg(PyObject *func) {
167+
_PyObject_CallNoArgs(PyObject *func) {
168168
PyThreadState *tstate = PyThreadState_Get();
169169
return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
170170
}

Include/internal/pycore_call.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PyAPI_FUNC(PyObject *) _PyObject_Call(
2929
PyObject *kwargs);
3030

3131
static inline PyObject *
32-
_PyObject_CallNoArgTstate(PyThreadState *tstate, PyObject *func) {
32+
_PyObject_CallNoArgsTstate(PyThreadState *tstate, PyObject *func) {
3333
return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
3434
}
3535

Modules/_collectionsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,7 @@ defdict_missing(defdictobject *dd, PyObject *key)
20102010
Py_DECREF(tup);
20112011
return NULL;
20122012
}
2013-
value = _PyObject_CallNoArg(factory);
2013+
value = _PyObject_CallNoArgs(factory);
20142014
if (value == NULL)
20152015
return value;
20162016
if (PyObject_SetItem((PyObject *)dd, key, value) < 0) {

Modules/_ctypes/_ctypes.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ PyDict_SetItemProxy(PyObject *dict, PyObject *key, PyObject *item)
216216
PyObject *proxy;
217217
int result;
218218

219-
obj = _PyObject_CallNoArg((PyObject *)&DictRemover_Type);
219+
obj = _PyObject_CallNoArgs((PyObject *)&DictRemover_Type);
220220
if (obj == NULL)
221221
return -1;
222222

@@ -506,7 +506,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt
506506
return NULL;
507507
}
508508

509-
dict = (StgDictObject *)_PyObject_CallNoArg((PyObject *)&PyCStgDict_Type);
509+
dict = (StgDictObject *)_PyObject_CallNoArgs((PyObject *)&PyCStgDict_Type);
510510
if (!dict) {
511511
Py_DECREF(result);
512512
return NULL;
@@ -1067,7 +1067,7 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
10671067
stgdict items size, align, length contain info about pointers itself,
10681068
stgdict->proto has info about the pointed to type!
10691069
*/
1070-
stgdict = (StgDictObject *)_PyObject_CallNoArg(
1070+
stgdict = (StgDictObject *)_PyObject_CallNoArgs(
10711071
(PyObject *)&PyCStgDict_Type);
10721072
if (!stgdict)
10731073
return NULL;
@@ -1550,7 +1550,7 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
15501550
goto error;
15511551
}
15521552

1553-
stgdict = (StgDictObject *)_PyObject_CallNoArg(
1553+
stgdict = (StgDictObject *)_PyObject_CallNoArgs(
15541554
(PyObject *)&PyCStgDict_Type);
15551555
if (!stgdict)
15561556
goto error;
@@ -2006,7 +2006,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
20062006
if (result == NULL)
20072007
return NULL;
20082008

2009-
stgdict = (StgDictObject *)_PyObject_CallNoArg(
2009+
stgdict = (StgDictObject *)_PyObject_CallNoArgs(
20102010
(PyObject *)&PyCStgDict_Type);
20112011
if (!stgdict) {
20122012
Py_DECREF(result);
@@ -2120,7 +2120,7 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
21202120
goto error;
21212121
}
21222122

2123-
stgdict = (StgDictObject *)_PyObject_CallNoArg(
2123+
stgdict = (StgDictObject *)_PyObject_CallNoArgs(
21242124
(PyObject *)&PyCStgDict_Type);
21252125
if (!stgdict)
21262126
goto error;
@@ -2560,7 +2560,7 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
25602560
PyTypeObject *result;
25612561
StgDictObject *stgdict;
25622562

2563-
stgdict = (StgDictObject *)_PyObject_CallNoArg(
2563+
stgdict = (StgDictObject *)_PyObject_CallNoArgs(
25642564
(PyObject *)&PyCStgDict_Type);
25652565
if (!stgdict)
25662566
return NULL;
@@ -3985,10 +3985,10 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
39853985
goto error;
39863986
}
39873987
if (PyCArrayTypeObject_Check(ob))
3988-
ob = _PyObject_CallNoArg(ob);
3988+
ob = _PyObject_CallNoArgs(ob);
39893989
else
39903990
/* Create an instance of the pointed-to type */
3991-
ob = _PyObject_CallNoArg(dict->proto);
3991+
ob = _PyObject_CallNoArgs(dict->proto);
39923992
/*
39933993
XXX Is the following correct any longer?
39943994
We must not pass a byref() to the array then but
@@ -5596,7 +5596,7 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
55965596
CDataObject *result;
55975597
if (0 == cast_check_pointertype(ctype))
55985598
return NULL;
5599-
result = (CDataObject *)_PyObject_CallNoArg(ctype);
5599+
result = (CDataObject *)_PyObject_CallNoArgs(ctype);
56005600
if (result == NULL)
56015601
return NULL;
56025602

Modules/_ctypes/callbacks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void _CallPythonObject(void *mem,
187187
*/
188188
} else if (dict) {
189189
/* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */
190-
CDataObject *obj = (CDataObject *)_PyObject_CallNoArg(cnv);
190+
CDataObject *obj = (CDataObject *)_PyObject_CallNoArgs(cnv);
191191
if (!obj) {
192192
PrintError("create argument %zd:\n", i);
193193
Py_DECREF(cnv);
@@ -572,7 +572,7 @@ long Call_CanUnloadNow(void)
572572
return E_FAIL;
573573
}
574574

575-
result = _PyObject_CallNoArg(func);
575+
result = _PyObject_CallNoArgs(func);
576576
Py_DECREF(func);
577577
if (!result) {
578578
PyErr_WriteUnraisable(context ? context : Py_None);

Modules/_ctypes/cfield.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PyCField_FromDesc(PyObject *desc, Py_ssize_t index,
6161
#define CONT_BITFIELD 2
6262
#define EXPAND_BITFIELD 3
6363

64-
self = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type);
64+
self = (CFieldObject *)_PyObject_CallNoArgs((PyObject *)&PyCField_Type);
6565
if (self == NULL)
6666
return NULL;
6767
dict = PyType_stgdict(desc);

Modules/_ctypes/stgdict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ MakeFields(PyObject *type, CFieldObject *descr,
248248
}
249249
continue;
250250
}
251-
new_descr = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type);
251+
new_descr = (CFieldObject *)_PyObject_CallNoArgs((PyObject *)&PyCField_Type);
252252
if (new_descr == NULL) {
253253
Py_DECREF(fdescr);
254254
Py_DECREF(fieldlist);

Modules/_functoolsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ static int
14401440
_functools_exec(PyObject *module)
14411441
{
14421442
_functools_state *state = get_functools_state(module);
1443-
state->kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
1443+
state->kwd_mark = _PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
14441444
if (state->kwd_mark == NULL) {
14451445
return -1;
14461446
}

Modules/_io/bufferedio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ _bufferedreader_read_all(buffered *self)
15501550
goto cleanup;
15511551
}
15521552
if (readall) {
1553-
tmp = _PyObject_CallNoArg(readall);
1553+
tmp = _PyObject_CallNoArgs(readall);
15541554
Py_DECREF(readall);
15551555
if (tmp == NULL)
15561556
goto cleanup;

Modules/_lsprof.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ _lsprof_get_state(PyObject *module)
7676

7777
static _PyTime_t CallExternalTimer(ProfilerObject *pObj)
7878
{
79-
PyObject *o = _PyObject_CallNoArg(pObj->externalTimer);
79+
PyObject *o = _PyObject_CallNoArgs(pObj->externalTimer);
8080
if (o == NULL) {
8181
PyErr_WriteUnraisable(pObj->externalTimer);
8282
return 0;

Modules/_sqlite/connection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ step_callback(sqlite3_context *context, int argc, sqlite3_value **params)
710710
if (*aggregate_instance == NULL) {
711711
callback_context *ctx = (callback_context *)sqlite3_user_data(context);
712712
assert(ctx != NULL);
713-
*aggregate_instance = _PyObject_CallNoArg(ctx->callable);
713+
*aggregate_instance = _PyObject_CallNoArgs(ctx->callable);
714714
if (!*aggregate_instance) {
715715
set_sqlite_error(context,
716716
"user-defined aggregate's '__init__' method raised error");
@@ -1008,7 +1008,7 @@ progress_callback(void *ctx)
10081008

10091009
assert(ctx != NULL);
10101010
PyObject *callable = ((callback_context *)ctx)->callable;
1011-
ret = _PyObject_CallNoArg(callable);
1011+
ret = _PyObject_CallNoArgs(callable);
10121012
if (!ret) {
10131013
/* abort query if error occurred */
10141014
rc = -1;

Modules/_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3773,7 +3773,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
37733773
}
37743774

37753775
if (pw_info->callable) {
3776-
fn_ret = _PyObject_CallNoArg(pw_info->callable);
3776+
fn_ret = _PyObject_CallNoArgs(pw_info->callable);
37773777
if (!fn_ret) {
37783778
/* TODO: It would be nice to move _ctypes_add_traceback() into the
37793779
core python API, so we could use it to add a frame here */

Modules/_testcapimodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,7 @@ _make_call(void *callable)
28662866
PyObject *rc;
28672867
int success;
28682868
PyGILState_STATE s = PyGILState_Ensure();
2869-
rc = _PyObject_CallNoArg((PyObject *)callable);
2869+
rc = _PyObject_CallNoArgs((PyObject *)callable);
28702870
success = (rc != NULL);
28712871
Py_XDECREF(rc);
28722872
PyGILState_Release(s);
@@ -2937,7 +2937,7 @@ static int _pending_callback(void *arg)
29372937
{
29382938
/* we assume the argument is callable object to which we own a reference */
29392939
PyObject *callable = (PyObject *)arg;
2940-
PyObject *r = _PyObject_CallNoArg(callable);
2940+
PyObject *r = _PyObject_CallNoArgs(callable);
29412941
Py_DECREF(callable);
29422942
Py_XDECREF(r);
29432943
return r != NULL ? 0 : -1;
@@ -3729,7 +3729,7 @@ slot_tp_del(PyObject *self)
37293729
/* Execute __del__ method, if any. */
37303730
del = _PyObject_LookupSpecial(self, &PyId___tp_del__);
37313731
if (del != NULL) {
3732-
res = _PyObject_CallNoArg(del);
3732+
res = _PyObject_CallNoArgs(del);
37333733
if (res == NULL)
37343734
PyErr_WriteUnraisable(del);
37353735
else
@@ -4358,7 +4358,7 @@ temporary_c_thread(void *data)
43584358
/* Allocate a Python thread state for this thread */
43594359
state = PyGILState_Ensure();
43604360

4361-
res = _PyObject_CallNoArg(test_c_thread->callback);
4361+
res = _PyObject_CallNoArgs(test_c_thread->callback);
43624362
Py_CLEAR(test_c_thread->callback);
43634363

43644364
if (res == NULL) {
@@ -4893,7 +4893,7 @@ check_pyobject_freed_is_freed(PyObject *self, PyObject *Py_UNUSED(args))
48934893
#ifdef _Py_ADDRESS_SANITIZER
48944894
Py_RETURN_NONE;
48954895
#else
4896-
PyObject *op = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
4896+
PyObject *op = _PyObject_CallNoArgs((PyObject *)&PyBaseObject_Type);
48974897
if (op == NULL) {
48984898
return NULL;
48994899
}
@@ -5271,7 +5271,7 @@ bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
52715271
return NULL;
52725272
}
52735273

5274-
PyObject *res = _PyObject_CallNoArg(cls);
5274+
PyObject *res = _PyObject_CallNoArgs(cls);
52755275
if (res == NULL) {
52765276
return NULL;
52775277
}

Modules/itertoolsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ itertools_tee_impl(PyObject *module, PyObject *iterable, Py_ssize_t n)
10581058

10591059
PyTuple_SET_ITEM(result, 0, copyable);
10601060
for (i = 1; i < n; i++) {
1061-
copyable = _PyObject_CallNoArg(copyfunc);
1061+
copyable = _PyObject_CallNoArgs(copyfunc);
10621062
if (copyable == NULL) {
10631063
Py_DECREF(copyfunc);
10641064
Py_DECREF(result);

Modules/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pymain_run_interactive_hook(int *exitcode)
457457
goto error;
458458
}
459459

460-
result = _PyObject_CallNoArg(hook);
460+
result = _PyObject_CallNoArgs(hook);
461461
Py_DECREF(hook);
462462
if (result == NULL) {
463463
goto error;

Modules/mathmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ math_ceil(PyObject *module, PyObject *number)
12061206
if (!PyFloat_CheckExact(number)) {
12071207
PyObject *method = _PyObject_LookupSpecial(number, &PyId___ceil__);
12081208
if (method != NULL) {
1209-
PyObject *result = _PyObject_CallNoArg(method);
1209+
PyObject *result = _PyObject_CallNoArgs(method);
12101210
Py_DECREF(method);
12111211
return result;
12121212
}
@@ -1275,7 +1275,7 @@ math_floor(PyObject *module, PyObject *number)
12751275
{
12761276
PyObject *method = _PyObject_LookupSpecial(number, &PyId___floor__);
12771277
if (method != NULL) {
1278-
PyObject *result = _PyObject_CallNoArg(method);
1278+
PyObject *result = _PyObject_CallNoArgs(method);
12791279
Py_DECREF(method);
12801280
return result;
12811281
}
@@ -2130,7 +2130,7 @@ math_trunc(PyObject *module, PyObject *x)
21302130
Py_TYPE(x)->tp_name);
21312131
return NULL;
21322132
}
2133-
result = _PyObject_CallNoArg(trunc);
2133+
result = _PyObject_CallNoArgs(trunc);
21342134
Py_DECREF(trunc);
21352135
return result;
21362136
}

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ run_at_forkers(PyObject *lst, int reverse)
561561
for (i = 0; i < PyList_GET_SIZE(cpy); i++) {
562562
PyObject *func, *res;
563563
func = PyList_GET_ITEM(cpy, i);
564-
res = _PyObject_CallNoArg(func);
564+
res = _PyObject_CallNoArgs(func);
565565
if (res == NULL)
566566
PyErr_WriteUnraisable(func);
567567
else
@@ -1183,7 +1183,7 @@ path_converter(PyObject *o, void *p)
11831183
if (NULL == func) {
11841184
goto error_format;
11851185
}
1186-
res = _PyObject_CallNoArg(func);
1186+
res = _PyObject_CallNoArgs(func);
11871187
Py_DECREF(func);
11881188
if (NULL == res) {
11891189
goto error_exit;
@@ -14380,7 +14380,7 @@ PyOS_FSPath(PyObject *path)
1438014380
_PyType_Name(Py_TYPE(path)));
1438114381
}
1438214382

14383-
path_repr = _PyObject_CallNoArg(func);
14383+
path_repr = _PyObject_CallNoArgs(func);
1438414384
Py_DECREF(func);
1438514385
if (NULL == path_repr) {
1438614386
return NULL;

Objects/abstract.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
114114
}
115115
return defaultvalue;
116116
}
117-
result = _PyObject_CallNoArg(hint);
117+
result = _PyObject_CallNoArgs(hint);
118118
Py_DECREF(hint);
119119
if (result == NULL) {
120120
PyThreadState *tstate = _PyThreadState_GET();
@@ -1576,7 +1576,7 @@ PyNumber_Long(PyObject *o)
15761576
}
15771577
trunc_func = _PyObject_LookupSpecial(o, &PyId___trunc__);
15781578
if (trunc_func) {
1579-
result = _PyObject_CallNoArg(trunc_func);
1579+
result = _PyObject_CallNoArgs(trunc_func);
15801580
Py_DECREF(trunc_func);
15811581
if (result == NULL || PyLong_CheckExact(result)) {
15821582
return result;

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
572572
/* does it support __bytes__? */
573573
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
574574
if (func != NULL) {
575-
result = _PyObject_CallNoArg(func);
575+
result = _PyObject_CallNoArgs(func);
576576
Py_DECREF(func);
577577
if (result == NULL)
578578
return NULL;
@@ -2622,7 +2622,7 @@ bytes_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
26222622
integer argument before deferring to PyBytes_FromObject, something
26232623
PyObject_Bytes doesn't do. */
26242624
else if ((func = _PyObject_LookupSpecial(x, &PyId___bytes__)) != NULL) {
2625-
bytes = _PyObject_CallNoArg(func);
2625+
bytes = _PyObject_CallNoArgs(func);
26262626
Py_DECREF(func);
26272627
if (bytes == NULL)
26282628
return NULL;

Objects/call.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "Python.h"
2-
#include "pycore_call.h" // _PyObject_CallNoArgTstate()
2+
#include "pycore_call.h" // _PyObject_CallNoArgsTstate()
33
#include "pycore_ceval.h" // _PyEval_EvalFrame()
44
#include "pycore_object.h" // _PyObject_GC_TRACK()
55
#include "pycore_pyerrors.h" // _PyErr_Occurred()
@@ -110,7 +110,7 @@ PyObject *
110110
PyObject_CallNoArgs(PyObject *func)
111111
{
112112
PyThreadState *tstate = _PyThreadState_GET();
113-
return _PyObject_CallNoArgTstate(tstate, func);
113+
return _PyObject_CallNoArgsTstate(tstate, func);
114114
}
115115

116116

@@ -402,7 +402,7 @@ PyObject_CallObject(PyObject *callable, PyObject *args)
402402
PyThreadState *tstate = _PyThreadState_GET();
403403
assert(!_PyErr_Occurred(tstate));
404404
if (args == NULL) {
405-
return _PyObject_CallNoArgTstate(tstate, callable);
405+
return _PyObject_CallNoArgsTstate(tstate, callable);
406406
}
407407
if (!PyTuple_Check(args)) {
408408
_PyErr_SetString(tstate, PyExc_TypeError,
@@ -468,7 +468,7 @@ _PyObject_CallFunctionVa(PyThreadState *tstate, PyObject *callable,
468468
}
469469

470470
if (!format || !*format) {
471-
return _PyObject_CallNoArgTstate(tstate, callable);
471+
return _PyObject_CallNoArgsTstate(tstate, callable);
472472
}
473473

474474
if (is_size_t) {

0 commit comments

Comments
 (0)