Replace PyObject_CallFunctionObjArgs() with fastcall

* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)

PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.

This change is part of the fastcall project. The change on listsort() is
related to the issue #23507.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index beb12c9..2f238ed 100644
--- 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)) {
@@ -716,7 +716,7 @@
     }
 
     /* And call it. */
-    result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL);
+    result = _PyObject_CallArg1(meth, format_spec);
     Py_DECREF(meth);
 
     if (result && !PyUnicode_Check(result)) {
@@ -3011,7 +3011,7 @@
             Py_DECREF(checker);
             return ok;
         }
-        res = PyObject_CallFunctionObjArgs(checker, inst, NULL);
+        res = _PyObject_CallArg1(checker, inst);
         Py_LeaveRecursiveCall();
         Py_DECREF(checker);
         if (res != NULL) {
@@ -3085,7 +3085,7 @@
             Py_DECREF(checker);
             return ok;
         }
-        res = PyObject_CallFunctionObjArgs(checker, derived, NULL);
+        res = _PyObject_CallArg1(checker, derived);
         Py_LeaveRecursiveCall();
         Py_DECREF(checker);
         if (res != NULL) {
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 16b4fd7..853156e 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -98,8 +98,7 @@
 PyObject *
 PyByteArray_FromObject(PyObject *input)
 {
-    return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type,
-                                        input, NULL);
+    return _PyObject_CallArg1((PyObject *)&PyByteArray_Type, input);
 }
 
 PyObject *
@@ -1985,8 +1984,7 @@
 {
     PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
     if (type != &PyByteArray_Type && result != NULL) {
-        Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
-                                                       result, NULL));
+        Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
     }
     return result;
 }
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 5cdc2ca..b82945a 100644
--- 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;
@@ -2331,8 +2331,7 @@
 {
     PyObject *result = _PyBytes_FromHex(string, 0);
     if (type != &PyBytes_Type && result != NULL) {
-        Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
-                                                       result, NULL));
+        Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
     }
     return result;
 }
@@ -2569,7 +2568,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
index 31e1278..0d391e5 100644
--- 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/descrobject.c b/Objects/descrobject.c
index 076e741..82cc181 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1414,7 +1414,7 @@
         return -1;
     }
     if (value == NULL)
-        res = PyObject_CallFunctionObjArgs(func, obj, NULL);
+        res = _PyObject_CallArg1(func, obj);
     else
         res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
     if (res == NULL)
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2a01f70..b74941a 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -2066,8 +2066,7 @@
             _Py_IDENTIFIER(__missing__);
             missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
             if (missing != NULL) {
-                res = PyObject_CallFunctionObjArgs(missing,
-                                                   key, NULL);
+                res = _PyObject_CallArg1(missing, key);
                 Py_DECREF(missing);
                 return res;
             }
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index dae166d..72d31b1 100644
--- 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/floatobject.c b/Objects/floatobject.c
index 17a55dd..997d1f9 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1439,7 +1439,7 @@
         goto parse_error;
     result = PyFloat_FromDouble(negate ? -x : x);
     if (cls != (PyObject *)&PyFloat_Type && result != NULL) {
-        Py_SETREF(result, PyObject_CallFunctionObjArgs(cls, result, NULL));
+        Py_SETREF(result, _PyObject_CallArg1(cls, result));
     }
     return result;
 
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 2680ab0..1db83c9 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -43,7 +43,7 @@
             /* Save the current exception, if any. */
             PyErr_Fetch(&error_type, &error_value, &error_traceback);
 
-            res = PyObject_CallFunctionObjArgs(finalizer, self, NULL);
+            res = _PyObject_CallArg1(finalizer, self);
 
             if (res == NULL) {
                 PyErr_WriteUnraisable(self);
@@ -591,7 +591,7 @@
      *
      * (See PyErr_SetObject/_PyErr_CreateException code for details.)
      */
-    e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL);
+    e = _PyObject_CallArg1(PyExc_StopIteration, value);
     if (e == NULL) {
         return -1;
     }
diff --git a/Objects/listobject.c b/Objects/listobject.c
index dcd7b5e..81b6c48 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1970,8 +1970,7 @@
         }
 
         for (i = 0; i < saved_ob_size ; i++) {
-            keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i],
-                                                   NULL);
+            keys[i] = _PyObject_CallArg1(keyfunc, saved_ob_item[i]);
             if (keys[i] == NULL) {
                 for (i=i-1 ; i>=0 ; i--)
                     Py_DECREF(keys[i]);
diff --git a/Objects/longobject.c b/Objects/longobject.c
index c95f946..b9f6327 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -5282,8 +5282,7 @@
     Py_DECREF(bytes);
 
     if (type != &PyLong_Type) {
-        Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type,
-                                                         long_obj, NULL));
+        Py_SETREF(long_obj, _PyObject_CallArg1((PyObject *)type, long_obj));
     }
 
     return long_obj;
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 428d83c..eac07fb 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -1939,7 +1939,7 @@
     if (format == NULL)
         goto error;
 
-    structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
+    structobj = _PyObject_CallArg1(Struct, format);
     if (structobj == NULL)
         goto error;
 
@@ -1978,7 +1978,7 @@
     PyObject *v;
 
     memcpy(x->item, ptr, x->itemsize);
-    v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL);
+    v = _PyObject_CallArg1(x->unpack_from, x->mview);
     if (v == NULL)
         return NULL;
 
diff --git a/Objects/object.c b/Objects/object.c
index d88ae3b..4844bd7 100644
--- 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
index 22b1f1d..77fb3a1 100644
--- 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/Objects/typeobject.c b/Objects/typeobject.c
index 186c570..a9f3520 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3487,9 +3487,7 @@
         sorted = _PyDict_GetItemId(builtins, &PyId_sorted);
         if (sorted == NULL)
             goto error;
-        sorted_methods = PyObject_CallFunctionObjArgs(sorted,
-                                                      abstract_methods,
-                                                      NULL);
+        sorted_methods = _PyObject_CallArg1(sorted, abstract_methods);
         if (sorted_methods == NULL)
             goto error;
         comma = _PyUnicode_FromId(&comma_id);
@@ -6193,7 +6191,7 @@
         else
             attr = descr;
     }
-    res = PyObject_CallFunctionObjArgs(attr, name, NULL);
+    res = _PyObject_CallArg1(attr, name);
     Py_XDECREF(descr);
     return res;
 }
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1c2257e..8f6f6c6 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4269,7 +4269,7 @@
     if (*exceptionObject == NULL)
         goto onError;
 
-    restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
+    restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
     if (restuple == NULL)
         goto onError;
     if (!PyTuple_Check(restuple)) {
@@ -4368,7 +4368,7 @@
     if (*exceptionObject == NULL)
         goto onError;
 
-    restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
+    restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
     if (restuple == NULL)
         goto onError;
     if (!PyTuple_Check(restuple)) {
@@ -6649,8 +6649,7 @@
     if (*exceptionObject == NULL)
         return NULL;
 
-    restuple = PyObject_CallFunctionObjArgs(
-        *errorHandler, *exceptionObject, NULL);
+    restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
     if (restuple == NULL)
         return NULL;
     if (!PyTuple_Check(restuple)) {
@@ -8644,8 +8643,7 @@
     if (*exceptionObject == NULL)
         return NULL;
 
-    restuple = PyObject_CallFunctionObjArgs(
-        *errorHandler, *exceptionObject, NULL);
+    restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
     if (restuple == NULL)
         return NULL;
     if (!PyTuple_Check(restuple)) {
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index ab6b235..2f33aed 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -867,7 +867,7 @@
 static void
 handle_callback(PyWeakReference *ref, PyObject *callback)
 {
-    PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);
+    PyObject *cbresult = _PyObject_CallArg1(callback, ref);
 
     if (cbresult == NULL)
         PyErr_WriteUnraisable(callback);