diff options
-rw-r--r-- | Doc/whatsnew/3.9.rst | 5 | ||||
-rw-r--r-- | Include/genobject.h | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2019-09-05-14-17-21.bpo-15088.plt8Em.rst | 4 | ||||
-rw-r--r-- | Objects/genobject.c | 16 | ||||
-rw-r--r-- | Python/ceval.c | 5 |
5 files changed, 9 insertions, 22 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 756690d..5670cb5 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -222,6 +222,11 @@ Removed * ``PyThreadState_DeleteCurrent()`` has been removed. It was not documented. (Contributed by Joannah Nanjekye in :issue:`37878`.) +* The C function ``PyGen_NeedsFinalizing`` has been removed. It was not + documented, tested or used anywhere within CPython after the implementation + of :pep:`442`. Patch by Joannah Nanjekye. + (Contributed by Joannah Nanjekye in :issue:`15088`) + Porting to Python 3.9 ===================== diff --git a/Include/genobject.h b/Include/genobject.h index 6755963..3b3b68b 100644 --- a/Include/genobject.h +++ b/Include/genobject.h @@ -43,7 +43,6 @@ PyAPI_DATA(PyTypeObject) PyGen_Type; PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *, PyObject *name, PyObject *qualname); -PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *); PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *); diff --git a/Misc/NEWS.d/next/C API/2019-09-05-14-17-21.bpo-15088.plt8Em.rst b/Misc/NEWS.d/next/C API/2019-09-05-14-17-21.bpo-15088.plt8Em.rst new file mode 100644 index 0000000..8a27afc --- /dev/null +++ b/Misc/NEWS.d/next/C API/2019-09-05-14-17-21.bpo-15088.plt8Em.rst @@ -0,0 +1,4 @@ +The C function ``PyGen_NeedsFinalizing`` has been removed. It was not +documented, tested or used anywhere within CPython after the implementation +of :pep:`442`. Patch by Joannah Nanjekye. +(Patch by Joannah Nanjekye)
\ No newline at end of file diff --git a/Objects/genobject.c b/Objects/genobject.c index 5e0bfa4..9f490b4 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -819,22 +819,6 @@ PyGen_New(PyFrameObject *f) return gen_new_with_qualname(&PyGen_Type, f, NULL, NULL); } -int -PyGen_NeedsFinalizing(PyGenObject *gen) -{ - PyFrameObject *f = gen->gi_frame; - - if (f == NULL || f->f_stacktop == NULL) - return 0; /* no frame or empty blockstack == no finalization */ - - /* Any (exception-handling) block type requires cleanup. */ - if (f->f_iblock > 0) - return 1; - - /* No blocks, it's safe to skip finalization. */ - return 0; -} - /* Coroutine Object */ typedef struct { diff --git a/Python/ceval.c b/Python/ceval.c index 7a3f42c..f9e03b3 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3227,11 +3227,6 @@ main_loop: } case TARGET(SETUP_FINALLY): { - /* NOTE: If you add any new block-setup opcodes that - are not try/except/finally handlers, you may need - to update the PyGen_NeedsFinalizing() function. - */ - PyFrame_BlockSetup(f, SETUP_FINALLY, INSTR_OFFSET() + oparg, STACK_LEVEL()); DISPATCH(); |