Skip to content

Commit 757eada

Browse files
committed
Deprecate the old C API
1 parent 0e322e4 commit 757eada

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

Doc/deprecations/c-api-pending-removal-in-3.20.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ Pending removal in Python 3.20
77
representation.
88

99
* Macros :c:macro:`!Py_MATH_PIl` and :c:macro:`!Py_MATH_El`.
10+
11+
* :c:func:`!_PyInterpreterState_GetEvalFrameFunc` and
12+
:c:func:`!_PyInterpreterState_SetEvalFrameFunc` functions are deprecated
13+
and will be removed in Python 3.20. Use
14+
:c:func:`PyUnstable_InterpreterState_GetEvalFrameFunc` and
15+
:c:func:`PyUnstable_InterpreterState_SetEvalFrameFunc` instead.
16+
(Contributed by Victor Stinner in :gh:`141518`.)

Doc/whatsnew/3.11.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ Porting to Python 3.11
23052305
be used for ``size``.
23062306
(Contributed by Kumar Aditya in :issue:`46608`.)
23072307

2308-
* :c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*``
2308+
* :c:func:`!_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*``
23092309
as its second parameter, instead of ``PyFrameObject*``.
23102310
See :pep:`523` for more details of how to use this function pointer type.
23112311

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,13 @@ Deprecated C APIs
12331233
since 3.15 and will be removed in 3.20.
12341234
(Contributed by Sergey B Kirpichev in :gh:`141004`.)
12351235

1236+
* :c:func:`!_PyInterpreterState_GetEvalFrameFunc` and
1237+
:c:func:`!_PyInterpreterState_SetEvalFrameFunc` functions are deprecated
1238+
and will be removed in Python 3.20. Use
1239+
:c:func:`PyUnstable_InterpreterState_GetEvalFrameFunc` and
1240+
:c:func:`PyUnstable_InterpreterState_SetEvalFrameFunc` instead.
1241+
(Contributed by Victor Stinner in :gh:`141518`.)
1242+
12361243

12371244
.. Add C API deprecations above alphabetically, not here at the end.
12381245

Include/cpython/pystate.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,5 +312,16 @@ PyAPI_FUNC(void) PyUnstable_InterpreterState_SetEvalFrameFunc(
312312

313313
// Deprecated aliases kept for backward compatibility
314314
#define _PyFrameEvalFunction PyUnstable_FrameEvalFunction
315-
#define _PyInterpreterState_GetEvalFrameFunc PyUnstable_InterpreterState_GetEvalFrameFunc
316-
#define _PyInterpreterState_SetEvalFrameFunc PyUnstable_InterpreterState_SetEvalFrameFunc
315+
316+
Py_DEPRECATED(3.15) static inline PyUnstable_FrameEvalFunction
317+
_PyInterpreterState_GetEvalFrameFunc(PyInterpreterState *interp)
318+
{
319+
return PyUnstable_InterpreterState_GetEvalFrameFunc(interp);
320+
}
321+
322+
Py_DEPRECATED(3.15) static inline void
323+
_PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp,
324+
PyUnstable_FrameEvalFunction eval_frame)
325+
{
326+
PyUnstable_InterpreterState_SetEvalFrameFunc(interp, eval_frame);
327+
}

Misc/NEWS.d/3.9.0a5.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,6 @@ and undefined PY_SSIZE_T_CLEAN whwn an exception is set.
13051305
.. section: C API
13061306
13071307
Add a private API to get and set the frame evaluation function: add
1308-
:c:func:`_PyInterpreterState_GetEvalFrameFunc` and
1309-
:c:func:`_PyInterpreterState_SetEvalFrameFunc` C functions. The
1310-
:c:type:`_PyFrameEvalFunction` function type now takes a *tstate* parameter.
1308+
:c:func:`!_PyInterpreterState_GetEvalFrameFunc` and
1309+
:c:func:`!_PyInterpreterState_SetEvalFrameFunc` C functions. The
1310+
:c:type:`!_PyFrameEvalFunction` function type now takes a *tstate* parameter.

0 commit comments

Comments
 (0)