From 9234fed96c016e8fdcdb06dd4b6850975882ad3b Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Wed, 3 Jul 2019 15:31:57 +0200 Subject: [PATCH] bpo-37493: use _PyObject_CallNoArg in more places --- Doc/extending/newtypes.rst | 2 +- Modules/_collectionsmodule.c | 2 +- Modules/_ctypes/_ctypes.c | 20 ++++++++++---------- Modules/_ctypes/cfield.c | 3 +-- Modules/_testcapimodule.c | 2 +- Modules/posixmodule.c | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 308c06705e8d21..7e0b18d6299fb3 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -104,7 +104,7 @@ done. This can be done using the :c:func:`PyErr_Fetch` and /* This saves the current exception state */ PyErr_Fetch(&err_type, &err_value, &err_traceback); - cbresult = PyObject_CallObject(self->my_callback, NULL); + cbresult = PyObject_CallNoArgs(self->my_callback); if (cbresult == NULL) PyErr_WriteUnraisable(self->my_callback); else diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 45169ecd11af00..83482c3521c32b 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1977,7 +1977,7 @@ defdict_missing(defdictobject *dd, PyObject *key) Py_DECREF(tup); return NULL; } - value = PyEval_CallObject(factory, NULL); + value = _PyObject_CallNoArg(factory); if (value == NULL) return value; if (PyObject_SetItem((PyObject *)dd, key, value) < 0) { diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 2201c4520ad048..c6ae487b4cf046 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1001,8 +1001,8 @@ PyCPointerType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) stgdict items size, align, length contain info about pointers itself, stgdict->proto has info about the pointed to type! */ - stgdict = (StgDictObject *)PyObject_CallObject( - (PyObject *)&PyCStgDict_Type, NULL); + stgdict = (StgDictObject *)_PyObject_CallNoArg( + (PyObject *)&PyCStgDict_Type); if (!stgdict) return NULL; stgdict->size = sizeof(void *); @@ -1489,8 +1489,8 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) goto error; } - stgdict = (StgDictObject *)PyObject_CallObject( - (PyObject *)&PyCStgDict_Type, NULL); + stgdict = (StgDictObject *)_PyObject_CallNoArg( + (PyObject *)&PyCStgDict_Type); if (!stgdict) goto error; @@ -1946,8 +1946,8 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject if (result == NULL) return NULL; - stgdict = (StgDictObject *)PyObject_CallObject( - (PyObject *)&PyCStgDict_Type, NULL); + stgdict = (StgDictObject *)_PyObject_CallNoArg( + (PyObject *)&PyCStgDict_Type); if (!stgdict) { Py_DECREF(result); return NULL; @@ -2060,8 +2060,8 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) goto error; } - stgdict = (StgDictObject *)PyObject_CallObject( - (PyObject *)&PyCStgDict_Type, NULL); + stgdict = (StgDictObject *)_PyObject_CallNoArg( + (PyObject *)&PyCStgDict_Type); if (!stgdict) goto error; @@ -2454,8 +2454,8 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) PyTypeObject *result; StgDictObject *stgdict; - stgdict = (StgDictObject *)PyObject_CallObject( - (PyObject *)&PyCStgDict_Type, NULL); + stgdict = (StgDictObject *)_PyObject_CallNoArg( + (PyObject *)&PyCStgDict_Type); if (!stgdict) return NULL; diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index 95367d50937654..e0a50fde6a07a3 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -60,8 +60,7 @@ PyCField_FromDesc(PyObject *desc, Py_ssize_t index, #define CONT_BITFIELD 2 #define EXPAND_BITFIELD 3 - self = (CFieldObject *)PyObject_CallObject((PyObject *)&PyCField_Type, - NULL); + self = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type); if (self == NULL) return NULL; dict = PyType_stgdict(desc); diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 07aadea3e98395..8f34e935353ba1 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -4907,7 +4907,7 @@ bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs) return NULL; } - PyObject *res = PyObject_CallObject(cls, NULL); + PyObject *res = _PyObject_CallNoArg(cls); if (res == NULL) { return NULL; } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index b848710281e85c..777e933cab59b5 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -433,7 +433,7 @@ run_at_forkers(PyObject *lst, int reverse) for (i = 0; i < PyList_GET_SIZE(cpy); i++) { PyObject *func, *res; func = PyList_GET_ITEM(cpy, i); - res = PyObject_CallObject(func, NULL); + res = _PyObject_CallNoArg(func); if (res == NULL) PyErr_WriteUnraisable(func); else pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy