bpo-41756: Export PyGen_Send and wrap it in if-defs (#22677)

This commit is contained in:
Vladimir Matveev 2020-10-13 10:26:51 -07:00 committed by GitHub
parent 66c28f50c7
commit cfb0f57ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -50,6 +50,8 @@ something like this::
The enum value used to represent different results of :c:func:`PyIter_Send`. 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) .. 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_RETURN`` if iterator returns. Return value is returned via *presult*.
- ``PYGEN_NEXT`` if iterator yields. Yielded 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``. - ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.
.. versionadded:: 3.10

View File

@ -338,6 +338,7 @@ PyAPI_FUNC(int) PyIter_Check(PyObject *);
NULL with an exception means an error occurred. */ NULL with an exception means an error occurred. */
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
typedef enum { typedef enum {
PYGEN_RETURN = 0, PYGEN_RETURN = 0,
PYGEN_ERROR = -1, PYGEN_ERROR = -1,
@ -353,6 +354,7 @@ typedef enum {
- PYGEN_NEXT (1) if generator has yielded. - PYGEN_NEXT (1) if generator has yielded.
'result' parameter is filled with yielded value. */ 'result' parameter is filled with yielded value. */
PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **); PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **);
#endif
/* === Number Protocol ================================================== */ /* === Number Protocol ================================================== */

View File

@ -287,6 +287,7 @@ EXPORT_FUNC(PyInterpreterState_GetID)
EXPORT_FUNC(PyInterpreterState_New) EXPORT_FUNC(PyInterpreterState_New)
EXPORT_FUNC(PyIter_Check) EXPORT_FUNC(PyIter_Check)
EXPORT_FUNC(PyIter_Next) EXPORT_FUNC(PyIter_Next)
EXPORT_FUNC(PyIter_Send)
EXPORT_FUNC(PyList_Append) EXPORT_FUNC(PyList_Append)
EXPORT_FUNC(PyList_AsTuple) EXPORT_FUNC(PyList_AsTuple)
EXPORT_FUNC(PyList_GetItem) EXPORT_FUNC(PyList_GetItem)