Skip to content

Commit ae8b114

Browse files
authored
gh-106320: Move private _PyGen API to the internal C API (#107032)
Move private _PyGen API to internal C API: * _PyAsyncGenAThrow_Type * _PyAsyncGenWrappedValue_Type * _PyCoroWrapper_Type * _PyGen_FetchStopIterationValue() * _PyGen_Finalize() * _PyGen_SetStopIterationValue() No longer these symbols, except of the ones by the _asyncio shared extensions.
1 parent eda9ce1 commit ae8b114

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Include/cpython/genobject.h

-6
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ PyAPI_DATA(PyTypeObject) PyGen_Type;
4141
PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *);
4242
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
4343
PyObject *name, PyObject *qualname);
44-
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
45-
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
46-
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
4744
PyAPI_FUNC(PyCodeObject *) PyGen_GetCode(PyGenObject *gen);
4845

4946

@@ -54,7 +51,6 @@ typedef struct {
5451
} PyCoroObject;
5552

5653
PyAPI_DATA(PyTypeObject) PyCoro_Type;
57-
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
5854

5955
#define PyCoro_CheckExact(op) Py_IS_TYPE((op), &PyCoro_Type)
6056
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
@@ -69,8 +65,6 @@ typedef struct {
6965

7066
PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
7167
PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
72-
PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type;
73-
PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
7468

7569
PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
7670
PyObject *name, PyObject *qualname);

Include/internal/pycore_genobject.h

+11
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ extern "C" {
99
#endif
1010

1111
extern PyObject *_PyGen_yf(PyGenObject *);
12+
extern void _PyGen_Finalize(PyObject *self);
13+
14+
// _asyncio shared extensions uses _PyGen_SetStopIterationValue() and
15+
// _PyGen_FetchStopIterationValue()
16+
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
17+
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
18+
1219
extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
1320
extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
1421

22+
extern PyTypeObject _PyCoroWrapper_Type;
23+
extern PyTypeObject _PyAsyncGenWrappedValue_Type;
24+
extern PyTypeObject _PyAsyncGenAThrow_Type;
25+
1526
/* runtime lifecycle */
1627

1728
extern void _PyAsyncGen_Fini(PyInterpreterState *);

0 commit comments

Comments
 (0)