8000 gh-105107: Remove PyEval_CallFunction() function · python/cpython@4022016 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4022016

Browse files
committed
gh-105107: Remove PyEval_CallFunction() function
Remove 4 functions from the C API, deprecated in Python 3.9: * PyEval_CallObjectWithKeywords() * PyEval_CallObject() * PyEval_CallFunction() * PyEval_CallMethod() Keep 3 functions in the stable ABI: * PyEval_CallObjectWithKeywords() * PyEval_CallFunction() * PyEval_CallMethod()
1 parent 4b65d56 commit 4022016

File tree

6 files changed

+28
-32
lines changed

6 files changed

+28
-32
lines changed

Doc/data/stable_abi.dat

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/whatsnew/3.13.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,12 @@ Deprecated
298298
Removed
299299
-------
300300

301+
* Remove functions deprecated in Python 3.9.
302+
303+
* ``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use
304+
:c:func:`PyObject_CallNoArgs` and :c:func:`PyObject_Call` (positional
305+
arguments must not be *NULL*) instead.
306+
* ``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead.
307+
* ``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead.
308+
309+
(Contributed by Victor Stinner in :gh:`105107`.)

Include/ceval.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,6 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
1717
PyObject *const *defs, int defc,
1818
PyObject *kwdefs, PyObject *closure);
1919

20-
/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
21-
* and PyEval_CallMethod are deprecated. Since they are officially part of the
22-
* stable ABI (PEP 384), they must be kept for backward compatibility.
23-
* PyObject_Call(), PyObject_CallFunction() and PyObject_CallMethod() are
24-
* recommended to call a callable object.
25-
*/
26-
27-
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
28-
PyObject *callable,
29-
PyObject *args,
30-
PyObject *kwargs);
31-
32-
/* Deprecated since PyEval_CallObjectWithKeywords is deprecated */
33-
#define PyEval_CallObject(callable, arg) \
34-
PyEval_CallObjectWithKeywords((callable), (arg), _PyObject_CAST(_Py_NULL))
35-
36-
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallFunction(
37-
PyObject *callable, const char *format, ...);
38-
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
39-
PyObject *obj, const char *name, const char *format, ...);
40-
4120
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
4221
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
4322
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Remove functions deprecated in Python 3.9.
2+
3+
* ``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use
4+
:c:func:`PyObject_CallNoArgs` and :c:func:`PyObject_Call` (positional
5+
arguments must not be *NULL*) instead.
6+
* ``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead.
7+
* ``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead.
8+
9+
Patch by Victor Stinner.

Misc/stable_abi.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,13 @@
667667
added = '3.2'
668668
[function.PyEval_CallFunction]
669669
added = '3.2'
670+
abi_only = true
670671
[function.PyEval_CallMethod]
671672
added = '3.2'
673+
abi_only = true
672674
[function.PyEval_CallObjectWithKeywords]
673675
added = '3.2'
676+
abi_only = true
674677
[function.PyEval_EvalCode]
675678
added = '3.2'
676679
[function.PyEval_EvalCodeEx]

Objects/call.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,9 @@ _PyFunction_Vectorcall(PyObject *func, PyObject* const* stack,
426426
/* --- More complex call functions -------------------------------- */
427427

428428
/* External interface to call any callable object.
429-
The args must be a tuple or NULL. The kwargs must be a dict or NULL. */
430-
PyObject *
429+
The args must be a tuple or NULL. The kwargs must be a dict or NULL.
430+
Function removed in Python 3.13 API but kept in the stable ABI. */
431+
PyAPI_FUNC(PyObject*)
431432
PyEval_CallObjectWithKeywords(PyObject *callable,
432433
PyObject *args, PyObject *kwargs)
433434
{
@@ -589,9 +590,8 @@ PyObject_CallFunction(PyObject *callable, const char *format, ...)
589590

590591

591592
/* PyEval_CallFunction is exact copy of PyObject_CallFunction.
592-
* This function is kept for backward compatibility.
593-
*/
594-
PyObject *
593+
Function removed in Python 3.13 API but kept in the stable ABI. */
594+
PyAPI_FUNC(PyObject*)
595595
PyEval_CallFunction(PyObject *callable, const char *format, ...)
596596
{
597597
va_list va;
@@ -659,9 +659,8 @@ PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
659659

660660

661661
/* PyEval_CallMethod is exact copy of PyObject_CallMethod.
662-
* This function is kept for backward compatibility.
663-
*/
664-
PyObject *
662+
Function removed in Python 3.13 API but kept in the stable ABI. */
663+
PyAPI_FUNC(PyObject*)
665664
PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
666665
{
667666
PyThreadState *tstate = _PyThreadState_GET();

0 commit comments

Comments
 (0)
0