diff options
author | Victor Stinner <vstinner@python.org> | 2022-03-21 01:15:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-21 01:15:32 +0100 |
commit | 332b04bac35cd7305c60da2d5733940dc089949a (patch) | |
tree | a546b206bbbda8fe576e1b25ec2c609e20d1faf9 | |
parent | 9d1c4d69dbc800ac344565119337fcf490cdc800 (diff) | |
download | cpython-git-332b04bac35cd7305c60da2d5733940dc089949a.tar.gz |
bpo-46850: Remove _PyEval_SetAsyncGenFinalizer() (GH-32017)
Remove the following private undocumented functions from the C API:
* _PyEval_GetAsyncGenFirstiter()
* _PyEval_GetAsyncGenFinalizer()
* _PyEval_SetAsyncGenFirstiter()
* _PyEval_SetAsyncGenFinalizer()
Call the public sys.get_asyncgen_hooks() and sys.set_asyncgen_hooks()
functions instead.
-rw-r--r-- | Include/cpython/ceval.h | 4 | ||||
-rw-r--r-- | Include/internal/pycore_ceval.h | 8 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2022-03-21-00-41-29.bpo-46850.rOt771.rst | 9 | ||||
-rw-r--r-- | Python/sysmodule.c | 2 |
4 files changed, 18 insertions, 5 deletions
diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h index 5a904bd3f0..47c86f9da2 100644 --- a/Include/cpython/ceval.h +++ b/Include/cpython/ceval.h @@ -9,10 +9,6 @@ PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyO PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); PyAPI_FUNC(int) _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void); -PyAPI_FUNC(int) _PyEval_SetAsyncGenFirstiter(PyObject *); -PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void); -PyAPI_FUNC(int) _PyEval_SetAsyncGenFinalizer(PyObject *); -PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void); /* Helper to look up a builtin object */ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltin(PyObject *); diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 70178e3865..3efd13d01c 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -37,6 +37,14 @@ PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth( PyThreadState *tstate, int new_depth); +// Used by sys.get_asyncgen_hooks() +extern PyObject* _PyEval_GetAsyncGenFirstiter(void); +extern PyObject* _PyEval_GetAsyncGenFinalizer(void); + +// Used by sys.set_asyncgen_hooks() +extern int _PyEval_SetAsyncGenFirstiter(PyObject *); +extern int _PyEval_SetAsyncGenFinalizer(PyObject *); + void _PyEval_Fini(void); diff --git a/Misc/NEWS.d/next/C API/2022-03-21-00-41-29.bpo-46850.rOt771.rst b/Misc/NEWS.d/next/C API/2022-03-21-00-41-29.bpo-46850.rOt771.rst new file mode 100644 index 0000000000..b3740ae740 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2022-03-21-00-41-29.bpo-46850.rOt771.rst @@ -0,0 +1,9 @@ +Remove the following private undocumented functions from the C API: + +* ``_PyEval_GetAsyncGenFirstiter()`` +* ``_PyEval_GetAsyncGenFinalizer()`` +* ``_PyEval_SetAsyncGenFirstiter()`` +* ``_PyEval_SetAsyncGenFinalizer()`` + +Call the public :func:`sys.get_asyncgen_hooks` and +:func:`sys.set_asyncgen_hooks` functions instead. Patch by Victor Stinner. diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 99540b09c1..ae6d7c2955 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -16,7 +16,7 @@ Data members: #include "Python.h" #include "pycore_call.h" // _PyObject_CallNoArgs() -#include "pycore_ceval.h" // _Py_RecursionLimitLowerWaterMark() +#include "pycore_ceval.h" // _PyEval_SetAsyncGenFinalizer() #include "pycore_code.h" // _Py_QuickenedCount #include "pycore_frame.h" // _PyInterpreterFrame #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() |