[Python-checkins] cpython: Use _PyObject_CallNoArg()

victor.stinner python-checkins at python.org
Tue Dec 6 12:48:12 EST 2016


https://hg.python.org/cpython/rev/57379d7f8e46
changeset: 105486:57379d7f8e46
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Dec 06 18:46:19 2016 +0100
summary:
 Use _PyObject_CallNoArg()
Replace:
 PyObject_CallFunctionObjArgs(callable, NULL)
with:
 _PyObject_CallNoArg(callable)
files:
 Modules/_asynciomodule.c | 2 +-
 Modules/_ctypes/_ctypes.c | 2 +-
 Modules/_ctypes/callbacks.c | 2 +-
 Modules/_ssl.c | 2 +-
 Modules/mathmodule.c | 6 +++---
 Modules/posixmodule.c | 4 ++--
 Objects/abstract.c | 2 +-
 Objects/bytesobject.c | 4 ++--
 Objects/complexobject.c | 2 +-
 Objects/enumobject.c | 2 +-
 Objects/object.c | 4 ++--
 Objects/odictobject.c | 2 +-
 Python/bltinmodule.c | 2 +-
 Python/ceval.c | 4 ++--
 Python/sysmodule.c | 2 +-
 15 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1948,7 +1948,7 @@
 
 if (!exc) {
 /* exc was not a CancelledError */
- exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
+ exc = _PyObject_CallNoArg(asyncio_CancelledError);
 if (!exc) {
 goto fail;
 }
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -5258,7 +5258,7 @@
 CDataObject *result;
 if (0 == cast_check_pointertype(ctype))
 return NULL;
- result = (CDataObject *)PyObject_CallFunctionObjArgs(ctype, NULL);
+ result = (CDataObject *)_PyObject_CallNoArg(ctype);
 if (result == NULL)
 return NULL;
 
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -181,7 +181,7 @@
 */
 } else if (dict) {
 /* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */
- CDataObject *obj = (CDataObject *)PyObject_CallFunctionObjArgs(cnv, NULL);
+ CDataObject *obj = (CDataObject *)_PyObject_CallNoArg(cnv);
 if (!obj) {
 PrintError("create argument %d:\n", i);
 Py_DECREF(cnv);
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3197,7 +3197,7 @@
 PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
 
 if (pw_info->callable) {
- fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL);
+ fn_ret = _PyObject_CallNoArg(pw_info->callable);
 if (!fn_ret) {
 /* TODO: It would be nice to move _ctypes_add_traceback() into the
 core python API, so we could use it to add a frame here */
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -951,7 +951,7 @@
 return NULL;
 return math_1_to_int(number, ceil, 0);
 }
- result = PyObject_CallFunctionObjArgs(method, NULL);
+ result = _PyObject_CallNoArg(method);
 Py_DECREF(method);
 return result;
 }
@@ -991,7 +991,7 @@
 return NULL;
 return math_1_to_int(number, floor, 0);
 }
- result = PyObject_CallFunctionObjArgs(method, NULL);
+ result = _PyObject_CallNoArg(method);
 Py_DECREF(method);
 return result;
 }
@@ -1542,7 +1542,7 @@
 Py_TYPE(number)->tp_name);
 return NULL;
 }
- result = PyObject_CallFunctionObjArgs(trunc, NULL);
+ result = _PyObject_CallNoArg(trunc);
 Py_DECREF(trunc);
 return result;
 }
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -902,7 +902,7 @@
 goto error_exit;
 }
 
- o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL);
+ o = to_cleanup = _PyObject_CallNoArg(func);
 Py_DECREF(func);
 if (NULL == o) {
 goto error_exit;
@@ -12046,7 +12046,7 @@
 Py_TYPE(path)->tp_name);
 }
 
- path_repr = PyObject_CallFunctionObjArgs(func, NULL);
+ path_repr = _PyObject_CallNoArg(func);
 Py_DECREF(func);
 if (NULL == path_repr) {
 return NULL;
diff --git a/Objects/abstract.c b/Objects/abstract.c
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -103,7 +103,7 @@
 }
 return defaultvalue;
 }
- result = PyObject_CallFunctionObjArgs(hint, NULL);
+ result = _PyObject_CallNoArg(hint);
 Py_DECREF(hint);
 if (result == NULL) {
 if (PyErr_ExceptionMatches(PyExc_TypeError)) {
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -549,7 +549,7 @@
 /* does it support __bytes__? */
 func = _PyObject_LookupSpecial(v, &PyId___bytes__);
 if (func != NULL) {
- result = PyObject_CallFunctionObjArgs(func, NULL);
+ result = _PyObject_CallNoArg(func);
 Py_DECREF(func);
 if (result == NULL)
 return NULL;
@@ -2569,7 +2569,7 @@
 PyObject_Bytes doesn't do. */
 func = _PyObject_LookupSpecial(x, &PyId___bytes__);
 if (func != NULL) {
- new = PyObject_CallFunctionObjArgs(func, NULL);
+ new = _PyObject_CallNoArg(func);
 Py_DECREF(func);
 if (new == NULL)
 return NULL;
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -273,7 +273,7 @@
 
 f = _PyObject_LookupSpecial(op, &PyId___complex__);
 if (f) {
- PyObject *res = PyObject_CallFunctionObjArgs(f, NULL);
+ PyObject *res = _PyObject_CallNoArg(f);
 Py_DECREF(f);
 if (res != NULL && !PyComplex_Check(res)) {
 PyErr_SetString(PyExc_TypeError,
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -258,7 +258,7 @@
 return NULL;
 }
 if (reversed_meth != NULL) {
- PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL);
+ PyObject *res = _PyObject_CallNoArg(reversed_meth);
 Py_DECREF(reversed_meth);
 return res;
 }
diff --git a/Objects/object.c b/Objects/object.c
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -596,7 +596,7 @@
 
 func = _PyObject_LookupSpecial(v, &PyId___bytes__);
 if (func != NULL) {
- result = PyObject_CallFunctionObjArgs(func, NULL);
+ result = _PyObject_CallNoArg(func);
 Py_DECREF(func);
 if (result == NULL)
 return NULL;
@@ -1314,7 +1314,7 @@
 return NULL;
 }
 /* use __dir__ */
- result = PyObject_CallFunctionObjArgs(dirfunc, NULL);
+ result = _PyObject_CallNoArg(dirfunc);
 Py_DECREF(dirfunc);
 if (result == NULL)
 return NULL;
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1256,7 +1256,7 @@
 if (PyODict_CheckExact(od))
 od_copy = PyODict_New();
 else
- od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL);
+ od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od));
 if (od_copy == NULL)
 return NULL;
 
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2074,7 +2074,7 @@
 }
 
 if (ndigits == NULL || ndigits == Py_None)
- result = PyObject_CallFunctionObjArgs(round, NULL);
+ result = _PyObject_CallNoArg(round);
 else
 result = PyObject_CallFunctionObjArgs(round, ndigits, NULL);
 Py_DECREF(round);
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3062,7 +3062,7 @@
 Py_DECREF(mgr);
 if (enter == NULL)
 goto error;
- res = PyObject_CallFunctionObjArgs(enter, NULL);
+ res = _PyObject_CallNoArg(enter);
 Py_DECREF(enter);
 if (res == NULL)
 goto error;
@@ -3096,7 +3096,7 @@
 }
 SET_TOP(exit);
 Py_DECREF(mgr);
- res = PyObject_CallFunctionObjArgs(enter, NULL);
+ res = _PyObject_CallNoArg(enter);
 Py_DECREF(enter);
 if (res == NULL)
 goto error;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1098,7 +1098,7 @@
 Py_TYPE(o)->tp_name);
 }
 else {
- res = PyObject_CallFunctionObjArgs(method, NULL);
+ res = _PyObject_CallNoArg(method);
 Py_DECREF(method);
 }
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /