]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46850: Remove _PyEval_SetAsyncGenFinalizer() (GH-32017)
authorVictor Stinner <vstinner@python.org>
Mon, 21 Mar 2022 00:15:32 +0000 (01:15 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Mar 2022 00:15:32 +0000 (01:15 +0100)
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.

Include/cpython/ceval.h
Include/internal/pycore_ceval.h
Misc/NEWS.d/next/C API/2022-03-21-00-41-29.bpo-46850.rOt771.rst [new file with mode: 0644]
Python/sysmodule.c

index 5a904bd3f08e90c92912c9164f22ede9fac55bcb..47c86f9da202f1630d27e9d6b26d34c2c7e44938 100644 (file)
@@ -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 *);
index 70178e38650cf5370d3a43f04ed7552a70572f5b..3efd13d01c7c52a5c232e8c78095103b8edc77b0 100644 (file)
@@ -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 (file)
index 0000000..b3740ae
--- /dev/null
@@ -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.
index 99540b09c1f465e4fd1331dc85d5aa7465418378..ae6d7c2955f818bb1fcfa86be7a6d04a8f2ee4ab 100644 (file)
@@ -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()