Skip to content

Commit 928dc07

Browse files
committed
deprecate c api
1 parent 5ace717 commit 928dc07

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Include/ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
1919

2020
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
2121
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
22-
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
22+
Py_DEPRECATED(3.14) PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
2323
PyAPI_FUNC(PyFrameObject *) PyEval_GetFrame(void);
2424

2525
PyAPI_FUNC(PyObject *) PyEval_GetFrameBuiltins(void);

Python/ceval.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,6 +2599,12 @@ _PyEval_GetBuiltinId(_Py_Identifier *name)
25992599
PyObject *
26002600
PyEval_GetLocals(void)
26012601
{
2602+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
2603+
"PyEval_GetLocals() is deprecated in Python 3.14 "
2604+
"and will be removed in 3.16.", 1))
2605+
{
2606+
return NULL;
2607+
}
26022608
// We need to return a borrowed reference here, so some tricks are needed
26032609
PyThreadState *tstate = _PyThreadState_GET();
26042610
_PyInterpreterFrame *current_frame = _PyThreadState_GetFrame(tstate);

0 commit comments

Comments
 (0)