diff options
author | Vladimir Matveev <vladima@fb.com> | 2020-10-13 17:26:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 17:26:51 (GMT) |
commit | cfb0f57ff876ab3d04ff144f19eda58844981643 (patch) | |
tree | 412498daac6bbcd044cfe5b208cc46859ea8d18c | |
parent | 66c28f50c76e4f23af7146e0e580457c5fd6bde7 (diff) | |
download | cpython-cfb0f57ff876ab3d04ff144f19eda58844981643.zip cpython-cfb0f57ff876ab3d04ff144f19eda58844981643.tar.gz cpython-cfb0f57ff876ab3d04ff144f19eda58844981643.tar.bz2 |
bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677)
-rw-r--r-- | Doc/c-api/iter.rst | 4 | ||||
-rw-r--r-- | Include/abstract.h | 2 | ||||
-rw-r--r-- | PC/python3dll.c | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst index a068a43..68df6f6 100644 --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -50,6 +50,8 @@ something like this:: The enum value used to represent different results of :c:func:`PyIter_Send`. + .. versionadded:: 3.10 + .. c:function:: PySendResult PyIter_Send(PyObject *iter, PyObject *arg, PyObject **presult) @@ -58,3 +60,5 @@ something like this:: - ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*. - ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*. - ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``. + + .. versionadded:: 3.10 diff --git a/Include/abstract.h b/Include/abstract.h index 716cd4b..28e576b 100644 --- a/Include/abstract.h +++ b/Include/abstract.h @@ -338,6 +338,7 @@ PyAPI_FUNC(int) PyIter_Check(PyObject *); NULL with an exception means an error occurred. */ PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000 typedef enum { PYGEN_RETURN = 0, PYGEN_ERROR = -1, @@ -353,6 +354,7 @@ typedef enum { - PYGEN_NEXT (1) if generator has yielded. 'result' parameter is filled with yielded value. */ PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **); +#endif /* === Number Protocol ================================================== */ diff --git a/PC/python3dll.c b/PC/python3dll.c index ff69ea7..153ba61 100644 --- a/PC/python3dll.c +++ b/PC/python3dll.c @@ -287,6 +287,7 @@ EXPORT_FUNC(PyInterpreterState_GetID) EXPORT_FUNC(PyInterpreterState_New) EXPORT_FUNC(PyIter_Check) EXPORT_FUNC(PyIter_Next) +EXPORT_FUNC(PyIter_Send) EXPORT_FUNC(PyList_Append) EXPORT_FUNC(PyList_AsTuple) EXPORT_FUNC(PyList_GetItem) |