bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)

Remove PyGen_NeedsFinalizing(): it was not
documented, tested or used anywhere within CPython after
the implementation of PEP 442.
This commit is contained in:
Joannah Nanjekye 2019-09-06 12:41:38 -03:00 committed by Victor Stinner
parent d8c93aa5d2
commit 74b662cf20
5 changed files with 9 additions and 22 deletions

View File

@ -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
=====================

View File

@ -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 *);

View File

@ -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)

View File

@ -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 {

View File

@ -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();