Skip to content

Commit cfb0f57

Browse files
authored
bpo-41756: Export PyGen_Send and wrap it in if-defs (python#22677)
1 parent 66c28f5 commit cfb0f57

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Doc/c-api/iter.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ something like this::
5050
5151
The enum value used to represent different results of :c:func:`PyIter_Send`.
5252
53+
.. versionadded:: 3.10
54+
5355
5456
.. c:function:: PySendResult PyIter_Send(PyObject *iter, PyObject *arg, PyObject **presult)
5557
@@ -58,3 +60,5 @@ something like this::
5860
- ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*.
5961
- ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*.
6062
- ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.
63+
64+
.. versionadded:: 3.10

Include/abstract.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ PyAPI_FUNC(int) PyIter_Check(PyObject *);
338338
NULL with an exception means an error occurred. */
339339
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
340340

341+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
341342
typedef enum {
342343
PYGEN_RETURN = 0,
343344
PYGEN_ERROR = -1,
@@ -353,6 +354,7 @@ typedef enum {
353354
- PYGEN_NEXT (1) if generator has yielded.
354355
'result' parameter is filled with yielded value. */
355356
PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **);
357+
#endif
356358

357359

358360
/* === Number Protocol ================================================== */

PC/python3dll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ EXPORT_FUNC(PyInterpreterState_GetID)
287287
EXPORT_FUNC(PyInterpreterState_New)
288288
EXPORT_FUNC(PyIter_Check)
289289
EXPORT_FUNC(PyIter_Next)
290+
EXPORT_FUNC(PyIter_Send)
290291
EXPORT_FUNC(PyList_Append)
291292
EXPORT_FUNC(PyList_AsTuple)
292293
EXPORT_FUNC(PyList_GetItem)

0 commit comments

Comments
 (0)