summaryrefslogtreecommitdiffstats
path: root/Objects/call.c
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2023-05-31 09:38:55 (GMT)
committerGitHub <noreply@github.com>2023-05-31 09:38:55 (GMT)
commitadccff3b3f9fbdb58cb4b8fde92456e6dd078af0 (patch)
tree3eea6fd8543a6a8e800b4792ad7c276598f3afb5 /Objects/call.c
parentf90d3f68db720bd6d0deda8cc0030339ccd43858 (diff)
downloadcpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.zip
cpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.tar.gz
cpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.tar.bz2
gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051)
Diffstat (limited to 'Objects/call.c')
-rw-r--r--Objects/call.c67
1 files changed, 21 insertions, 46 deletions
diff --git a/Objects/call.c b/Objects/call.c
index 0d548dc..e9002d3 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -519,7 +519,7 @@ _PyObject_Call_Prepend(PyThreadState *tstate, PyObject *callable,
static PyObject *
_PyObject_CallFunctionVa(PyThreadState *tstate, PyObject *callable,
- const char *format, va_list va, int is_size_t)
+ const char *format, va_list va)
{
PyObject* small_stack[_PY_FASTCALL_SMALL_STACK];
const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack);
@@ -535,14 +535,8 @@ _PyObject_CallFunctionVa(PyThreadState *tstate, PyObject *callable,
return _PyObject_CallNoArgsTstate(tstate, callable);
}
- if (is_size_t) {
- stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len,
- format, va, &nargs);
- }
- else {
- stack = _Py_VaBuildStack(small_stack, small_stack_len,
- format, va, &nargs);
- }
+ stack = _Py_VaBuildStack(small_stack, small_stack_len,
+ format, va, &nargs);
if (stack == NULL) {
return NULL;
}
@@ -581,7 +575,7 @@ PyObject_CallFunction(PyObject *callable, const char *format, ...)
PyThreadState *tstate = _PyThreadState_GET();
va_start(va, format);
- result = _PyObject_CallFunctionVa(tstate, callable, format, va, 0);
+ result = _PyObject_CallFunctionVa(tstate, callable, format, va);
va_end(va);
return result;
@@ -599,21 +593,24 @@ PyEval_CallFunction(PyObject *callable, const char *format, ...)
PyThreadState *tstate = _PyThreadState_GET();
va_start(va, format);
- result = _PyObject_CallFunctionVa(tstate, callable, format, va, 0);
+ result = _PyObject_CallFunctionVa(tstate, callable, format, va);
va_end(va);
return result;
}
-PyObject *
+/* _PyObject_CallFunction_SizeT is exact copy of PyObject_CallFunction.
+ * This function must be kept because it is part of the stable ABI.
+ */
+PyAPI_FUNC(PyObject *) /* abi_only */
_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...)
{
PyThreadState *tstate = _PyThreadState_GET();
va_list va;
va_start(va, format);
- PyObject *result = _PyObject_CallFunctionVa(tstate, callable, format, va, 1);
+ PyObject *result = _PyObject_CallFunctionVa(tstate, callable, format, va);
va_end(va);
return result;
@@ -621,7 +618,7 @@ _PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...)
static PyObject*
-callmethod(PyThreadState *tstate, PyObject* callable, const char *format, va_list va, int is_size_t)
+callmethod(PyThreadState *tstate, PyObject* callable, const char *format, va_list va)
{
assert(callable != NULL);
if (!PyCallable_Check(callable)) {
@@ -631,7 +628,7 @@ callmethod(PyThreadState *tstate, PyObject* callable, const char *format, va_lis
return NULL;
}
- return _PyObject_CallFunctionVa(tstate, callable, format, va, is_size_t);
+ return _PyObject_CallFunctionVa(tstate, callable, format, va);
}
PyObject *
@@ -650,7 +647,7 @@ PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 0);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
Py_DECREF(callable);
@@ -676,7 +673,7 @@ PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 0);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
Py_DECREF(callable);
@@ -700,7 +697,7 @@ _PyObject_CallMethod(PyObject *obj, PyObject *name,
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 1);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
Py_DECREF(callable);
@@ -724,7 +721,7 @@ _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name,
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 0);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
Py_DECREF(callable);
@@ -737,13 +734,15 @@ PyObject * _PyObject_CallMethodFormat(PyThreadState *tstate, PyObject *callable,
{
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 0);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
return retval;
}
-PyObject *
+// _PyObject_CallMethod_SizeT is exact copy of PyObject_CallMethod.
+// This function must be kept because it is part of the stable ABI.
+PyAPI_FUNC(PyObject *) /* abi_only */
_PyObject_CallMethod_SizeT(PyObject *obj, const char *name,
const char *format, ...)
{
@@ -759,31 +758,7 @@ _PyObject_CallMethod_SizeT(PyObject *obj, const char *name,
va_list va;
va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 1);
- va_end(va);
-
- Py_DECREF(callable);
- return retval;
-}
-
-
-PyObject *
-_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name,
- const char *format, ...)
-{
- PyThreadState *tstate = _PyThreadState_GET();
- if (obj == NULL || name == NULL) {
- return null_error(tstate);
- }
-
- PyObject *callable = _PyObject_GetAttrId(obj, name);
- if (callable == NULL) {
- return NULL;
- }
-
- va_list va;
- va_start(va, format);
- PyObject *retval = callmethod(tstate, callable, format, va, 1);
+ PyObject *retval = callmethod(tstate, callable, format, va);
va_end(va);
Py_DECREF(callable);