<https://github.com/python/pythoncapi-compat/>`_ can be used to get this
function on Python 3.8 and older.
(Contributed by Victor Stinner in :gh:`105268`.)
+
+* Remove the old aliases to functions calling functions which were kept for
+ backward compatibility with Python 3.8 provisional API:
+
+ * ``_PyObject_CallMethodNoArgs()``: use ``PyObject_CallMethodNoArgs()``
+ * ``_PyObject_CallMethodOneArg()``: use ``PyObject_CallMethodOneArg()``
+ * ``_PyObject_CallOneArg()``: use ``PyObject_CallOneArg()``
+ * ``_PyObject_FastCallDict()``: use ``PyObject_VectorcallDict()``
+ * ``_PyObject_Vectorcall()``: use ``PyObject_Vectorcall()``
+ * ``_PyObject_VectorcallMethod()``: use ``PyObject_VectorcallMethod()``
+ * ``_PyVectorcall_Function()``: use ``PyVectorcall_Function()``
+
+ Just remove the underscore prefix to update your code.
+ (Contributed by Victor Stinner in :gh:`106084`.)
PyAPI_FUNC(vectorcallfunc) PyVectorcall_Function(PyObject *callable);
-// Backwards compatibility aliases for API that was provisional in Python 3.8
-#define _PyObject_Vectorcall PyObject_Vectorcall
-#define _PyObject_VectorcallMethod PyObject_VectorcallMethod
-#define _PyObject_FastCallDict PyObject_VectorcallDict
-#define _PyVectorcall_Function PyVectorcall_Function
-#define _PyObject_CallOneArg PyObject_CallOneArg
-#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs
-#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg
-
/* Same as PyObject_Vectorcall except that keyword arguments are passed as
dict, which may be NULL if there are no keyword arguments. */
PyAPI_FUNC(PyObject *) PyObject_VectorcallDict(
--- /dev/null
+Remove the old aliases to functions calling functions which were kept for
+backward compatibility with Python 3.8 provisional API:
+
+* ``_PyObject_CallMethodNoArgs()``: use ``PyObject_CallMethodNoArgs()``
+* ``_PyObject_CallMethodOneArg()``: use ``PyObject_CallMethodOneArg()``
+* ``_PyObject_CallOneArg()``: use ``PyObject_CallOneArg()``
+* ``_PyObject_FastCallDict()``: use ``PyObject_VectorcallDict()``
+* ``_PyObject_Vectorcall()``: use ``PyObject_Vectorcall()``
+* ``_PyObject_VectorcallMethod()``: use ``PyObject_VectorcallMethod()``
+* ``_PyVectorcall_Function()``: use ``PyVectorcall_Function()``
+
+Just remove the underscore prefix to update your code. Patch by Victor
+Stinner.
static void
partial_setvectorcall(partialobject *pto)
{
- if (_PyVectorcall_Function(pto->fn) == NULL) {
+ if (PyVectorcall_Function(pto->fn) == NULL) {
/* Don't use vectorcall if the underlying function doesn't support it */
pto->vectorcall = NULL;
}
if (str == NULL)
return -1;
- wr = _PyObject_CallMethodOneArg(self->stream, str_write, str);
+ wr = PyObject_CallMethodOneArg(self->stream, str_write, str);
Py_DECREF(str);
if (wr == NULL)
return -1;
if (PyBytes_Size(pwrt) > 0) {
PyObject *wr;
- wr = _PyObject_CallMethodOneArg(self->stream, state->str_write, pwrt);
+ wr = PyObject_CallMethodOneArg(self->stream, state->str_write, pwrt);
if (wr == NULL) {
Py_DECREF(pwrt);
return NULL;
assert(nargs == 0 || args != NULL);
assert(kwargs == NULL || PyDict_Check(kwargs));
- vectorcallfunc func = _PyVectorcall_Function(callable);
+ vectorcallfunc func = PyVectorcall_Function(callable);
if (func == NULL) {
/* Use tp_call instead */
return _PyObject_MakeTpCall(tstate, callable, args, nargs, kwargs);
assert(PyTuple_Check(args));
assert(kwargs == NULL || PyDict_Check(kwargs));
EVAL_CALL_STAT_INC_IF_FUNCTION(EVAL_CALL_API, callable);
- vectorcallfunc vector_func = _PyVectorcall_Function(callable);
+ vectorcallfunc vector_func = PyVectorcall_Function(callable);
if (vector_func != NULL) {
return _PyVectorcall_Call(tstate, vector_func, callable, args, kwargs);
}
{
return NULL;
}
- return _PyObject_VectorcallMethod(&_Py_ID(get), newargs,
- 3 | PY_VECTORCALL_ARGUMENTS_OFFSET,
- NULL);
+ return PyObject_VectorcallMethod(&_Py_ID(get), newargs,
+ 3 | PY_VECTORCALL_ARGUMENTS_OFFSET,
+ NULL);
}
static PyObject *
}
/* Explicitly call file.flush() */
- PyObject *res = _PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
+ PyObject *res = PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
if (!res) {
return -1;
}
Py_XDECREF(spec);
if (busy) {
/* Wait until module is done importing. */
- PyObject *value = _PyObject_CallMethodOneArg(
+ PyObject *value = PyObject_CallMethodOneArg(
IMPORTLIB(interp), &_Py_ID(_lock_unlock_module), name);
if (value == NULL) {
return -1;
external= PyObject_GetAttrString(IMPORTLIB(interp),
"_bootstrap_external");
if (external != NULL) {
- pathobj = _PyObject_CallMethodOneArg(
+ pathobj = PyObject_CallMethodOneArg(
external, &_Py_ID(_get_sourcefile), cpathobj);
Py_DECREF(external);
}
s = PyMarshal_WriteObjectToString(value, version);
if (s == NULL)
return NULL;
- res = _PyObject_CallMethodOneArg(file, &_Py_ID(write), s);
+ res = PyObject_CallMethodOneArg(file, &_Py_ID(write), s);
Py_DECREF(s);
return res;
}
Py_XDECREF(ctx.seen);
/* Call file.flush() */
- PyObject *res = _PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
+ PyObject *res = PyObject_CallMethodNoArgs(file, &_Py_ID(flush));
if (!res) {
/* Silently ignore file.flush() error */
PyErr_Clear();
{
PyObject *f = _PySys_GetAttr(tstate, name);
if (f != NULL) {
- PyObject *r = _PyObject_CallMethodNoArgs(f, &_Py_ID(flush));
+ PyObject *r = PyObject_CallMethodNoArgs(f, &_Py_ID(flush));
if (r) {
Py_DECREF(r);
}
if (file == NULL)
return -1;
assert(unicode != NULL);
- PyObject *result = _PyObject_CallMethodOneArg(file, &_Py_ID(write), unicode);
+ PyObject *result = PyObject_CallMethodOneArg(file, &_Py_ID(write), unicode);
if (result == NULL) {
return -1;
}