]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677)
authorVladimir Matveev <vladima@fb.com>
Tue, 13 Oct 2020 17:26:51 +0000 (10:26 -0700)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 17:26:51 +0000 (10:26 -0700)
Doc/c-api/iter.rst
Include/abstract.h
PC/python3dll.c

index a068a43c86b6c39dd6614b4d32adc80a3a494448..68df6f6e89f5132d510d9a06af4ccfac125b7d4f 100644 (file)
@@ -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
index 716cd4b5ebbba3e062ff1912da26cbaff72516c5..28e576b92935f9e92f0e86347d43bcbfac1afe55 100644 (file)
@@ -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 ================================================== */
index ff69ea7ca5efaa47d7829d2dc450a833981349cc..153ba612b7804f5cb0315a508c8a4f7cc3201301 100644 (file)
@@ -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)