]> granicus.if.org Git - python/commitdiff
Use _PyObject_CallNoArg()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 6 Dec 2016 17:46:19 +0000 (18:46 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 6 Dec 2016 17:46:19 +0000 (18:46 +0100)
Replace:
    PyObject_CallFunctionObjArgs(callable, NULL)
with:
    _PyObject_CallNoArg(callable)

15 files changed:
Modules/_asynciomodule.c
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callbacks.c
Modules/_ssl.c
Modules/mathmodule.c
Modules/posixmodule.c
Objects/abstract.c
Objects/bytesobject.c
Objects/complexobject.c
Objects/enumobject.c
Objects/object.c
Objects/odictobject.c
Python/bltinmodule.c
Python/ceval.c
Python/sysmodule.c

index 67794c3fa53d90bdd7c74859318cb6b665eb6a1a..d8522b9403ded29f5c8749c8a9d8bf30f68270d7 100644 (file)
@@ -1948,7 +1948,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
 
         if (!exc) {
             /* exc was not a CancelledError */
-            exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
+            exc = _PyObject_CallNoArg(asyncio_CancelledError);
             if (!exc) {
                 goto fail;
             }
index 5048d9c544442e209066bd0c36ea6b5e56b1a8f2..47d8f56785974e8a2048488c10de4e3f38fd39f7 100644 (file)
@@ -5258,7 +5258,7 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
     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;
 
index b958f304c5401cafea88eef04f02805644555dc5..2c57d6b63930ffb05fdf42334cc43d1a9994284f 100644 (file)
@@ -181,7 +181,7 @@ static void _CallPythonObject(void *mem,
             */
         } 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);
index b1988570604db15819d63dbc52e3b6a107cfdfb7..6003476052cea8391398e52e87c2616dfed28b11 100644 (file)
@@ -3197,7 +3197,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
     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 */
index 95ea4f7fef83aa9a9e66165f53304414dfe3ae36..e7e34ef431839ac87c9893a8d4a23f95fb732bf5 100644 (file)
@@ -951,7 +951,7 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
             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 @@ static PyObject * math_floor(PyObject *self, PyObject *number) {
             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 @@ math_trunc(PyObject *self, PyObject *number)
                          Py_TYPE(number)->tp_name);
         return NULL;
     }
-    result = PyObject_CallFunctionObjArgs(trunc, NULL);
+    result = _PyObject_CallNoArg(trunc);
     Py_DECREF(trunc);
     return result;
 }
index bec7699b553e9409a0fb14789af4b8f8ff370344..fee5711e16978c0f71b9d78ebdf59b860255853b 100644 (file)
@@ -902,7 +902,7 @@ path_converter(PyObject *o, void *p)
             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 @@ PyOS_FSPath(PyObject *path)
                             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;
index 4cd96368b4f00b927be59f50308143d6bb169421..24948dbfea5f1247783ffc03b45a5a3ab41e5173 100644 (file)
@@ -103,7 +103,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
         }
         return defaultvalue;
     }
-    result = PyObject_CallFunctionObjArgs(hint, NULL);
+    result = _PyObject_CallNoArg(hint);
     Py_DECREF(hint);
     if (result == NULL) {
         if (PyErr_ExceptionMatches(PyExc_TypeError)) {
index 5cdc2ca30e81a1592a4d401a8fd85ef40ec8c199..0a5c0ae674958232de15b4871d88ff16ba0ee02c 100644 (file)
@@ -549,7 +549,7 @@ format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
     /* 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 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        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;
index 31e12784cc34f94f8c780aa51f199c8b328a4524..0d391e5208cc77453167cac3e7f296314f5ce6c6 100644 (file)
@@ -273,7 +273,7 @@ try_complex_special_method(PyObject *op) {
 
     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,
index dae166d5adf4687f1b68de68280ad0b9748fccf2..72d31b16af968bb11b0dc81d115d6d61d6a90063 100644 (file)
@@ -258,7 +258,7 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
         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;
     }
index d88ae3b94f3e7d49928a4dfe5d3ba4adfa3c902b..4844bd766911cb88f2b3d6161364e7ffe42d8a4a 100644 (file)
@@ -596,7 +596,7 @@ PyObject_Bytes(PyObject *v)
 
     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 @@ _dir_object(PyObject *obj)
         return NULL;
     }
     /* use __dir__ */
-    result = PyObject_CallFunctionObjArgs(dirfunc, NULL);
+    result = _PyObject_CallNoArg(dirfunc);
     Py_DECREF(dirfunc);
     if (result == NULL)
         return NULL;
index 22b1f1dfed9cce63219a869a5c65cbc857077361..77fb3a181dc2b3ce92d97565d3544ad366cfb1b5 100644 (file)
@@ -1256,7 +1256,7 @@ odict_copy(register PyODictObject *od)
     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;
 
index d0ba4e13155daed889987a86966a1d48830ea865..5e1f5624b96c1831c456c97eb69924f6b4fe69f4 100644 (file)
@@ -2074,7 +2074,7 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
     }
 
     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);
index 8420aec3b95ae1393684995cc2c3a9c906bd0163..c6c6e05650b076c1d94b16ad6653d2ec2bf20251 100644 (file)
@@ -3062,7 +3062,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
             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 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
             }
             SET_TOP(exit);
             Py_DECREF(mgr);
-            res = PyObject_CallFunctionObjArgs(enter, NULL);
+            res = _PyObject_CallNoArg(enter);
             Py_DECREF(enter);
             if (res == NULL)
                 goto error;
index 416a02b5466f44a9ab1bf6b8985539ba8444d5f3..1537313b4351d3b045e2681e55d8a344e60f90b5 100644 (file)
@@ -1098,7 +1098,7 @@ _PySys_GetSizeOf(PyObject *o)
                          Py_TYPE(o)->tp_name);
     }
     else {
-        res = PyObject_CallFunctionObjArgs(method, NULL);
+        res = _PyObject_CallNoArg(method);
         Py_DECREF(method);
     }