summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-02-23 10:19:01 (GMT)
committerGitHub <noreply@github.com>2023-02-23 10:19:01 (GMT)
commit22b8d77b98a5944e688be0927b8139c49d4a7257 (patch)
treec3693ee3bc939140e9ad885677d58cab59673993 /Include
parent572223f9ce99e8816abdcc1536db6c4ceed2d848 (diff)
downloadcpython-22b8d77b98a5944e688be0927b8139c49d4a7257.zip
cpython-22b8d77b98a5944e688be0927b8139c49d4a7257.tar.gz
cpython-22b8d77b98a5944e688be0927b8139c49d4a7257.tar.bz2
GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/genobject.h5
-rw-r--r--Include/internal/pycore_frame.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/Include/cpython/genobject.h b/Include/cpython/genobject.h
index 6127ba7..18b8ce9 100644
--- a/Include/cpython/genobject.h
+++ b/Include/cpython/genobject.h
@@ -13,8 +13,6 @@ extern "C" {
and coroutine objects. */
#define _PyGenObject_HEAD(prefix) \
PyObject_HEAD \
- /* The code object backing the generator */ \
- PyCodeObject *prefix##_code; \
/* List of weak reference. */ \
PyObject *prefix##_weakreflist; \
/* Name of the generator. */ \
@@ -28,7 +26,7 @@ extern "C" {
char prefix##_running_async; \
/* The frame */ \
int8_t prefix##_frame_state; \
- PyObject *prefix##_iframe[1];
+ PyObject *prefix##_iframe[1]; \
typedef struct {
/* The gi_ prefix is intended to remind of generator-iterator. */
@@ -46,6 +44,7 @@ PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
+PyAPI_FUNC(PyCodeObject *) PyGen_GetCode(PyGenObject *gen);
/* --- PyCoroObject ------------------------------------------------------- */
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h
index 81d16b2..5806cf0 100644
--- a/Include/internal/pycore_frame.h
+++ b/Include/internal/pycore_frame.h
@@ -209,7 +209,7 @@ _PyFrame_GetFrameObject(_PyInterpreterFrame *frame)
* frames like the ones in generators and coroutines.
*/
void
-_PyFrame_Clear(_PyInterpreterFrame * frame);
+_PyFrame_ClearExceptCode(_PyInterpreterFrame * frame);
int
_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg);