(original) (raw)
changeset: 77476:cfbf6aa5c9e3 user: Nick Coghlan ncoghlan@gmail.com date: Sun Jun 17 15:15:49 2012 +1000 files: Include/genobject.h Include/pyerrors.h Misc/NEWS Objects/exceptions.c Objects/genobject.c Python/ceval.c description: Issue #13783: the PEP 380 implementation no longer expands the public C API diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Include/genobject.h --- a/Include/genobject.h Sat Jun 16 21:49:08 2012 -0500 +++ b/Include/genobject.h Sun Jun 17 15:15:49 2012 +1000 @@ -34,7 +34,7 @@ PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); -PyAPI_FUNC(int) PyGen_FetchStopIterationValue(PyObject **); +PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); PyObject *_PyGen_Send(PyGenObject *, PyObject *); #ifdef __cplusplus diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Include/pyerrors.h --- a/Include/pyerrors.h Sat Jun 16 21:49:08 2012 -0500 +++ b/Include/pyerrors.h Sun Jun 17 15:15:49 2012 +1000 @@ -400,9 +400,6 @@ const char *reason /* UTF-8 encoded string */ ); -/* create a StopIteration exception with the given value */ -PyAPI_FUNC(PyObject *) PyStopIteration_Create(PyObject *); - /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are not available on all platforms, which is why we provide emulations diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Misc/NEWS --- a/Misc/NEWS Sat Jun 16 21:49:08 2012 -0500 +++ b/Misc/NEWS Sun Jun 17 15:15:49 2012 +1000 @@ -111,6 +111,12 @@ - Issue #14963: Convert contextlib.ExitStack.__exit__ to use an iterative algorithm (Patch by Alon Horev) +C-API +----- + +- Issue #13783: Inadvertent additions to the public C API in the PEP 380 + implementation have either been removed or marked as private interfaces. + Extension Modules ----------------- diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Objects/exceptions.c --- a/Objects/exceptions.c Sat Jun 16 21:49:08 2012 -0500 +++ b/Objects/exceptions.c Sun Jun 17 15:15:49 2012 +1000 @@ -516,12 +516,6 @@ return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); } -PyObject * -PyStopIteration_Create(PyObject *value) -{ - return PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL); -} - ComplexExtendsException( PyExc_Exception, /* base */ StopIteration, /* name */ diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Objects/genobject.c --- a/Objects/genobject.c Sat Jun 16 21:49:08 2012 -0500 +++ b/Objects/genobject.c Sun Jun 17 15:15:49 2012 +1000 @@ -97,7 +97,8 @@ /* Delay exception instantiation if we can */ PyErr_SetNone(PyExc_StopIteration); } else { - PyObject *e = PyStopIteration_Create(result); + PyObject *e = PyObject_CallFunctionObjArgs( + PyExc_StopIteration, result, NULL); if (e != NULL) { PyErr_SetObject(PyExc_StopIteration, e); Py_DECREF(e); @@ -339,7 +340,7 @@ Py_DECREF(ret); /* Termination repetition of YIELD_FROM */ gen->gi_frame->f_lasti++; - if (PyGen_FetchStopIterationValue(&val) == 0) { + if (_PyGen_FetchStopIterationValue(&val) == 0) { ret = gen_send_ex(gen, val, 0); Py_DECREF(val); } else { @@ -428,7 +429,7 @@ */ int -PyGen_FetchStopIterationValue(PyObject **pvalue) { +_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; diff -r 115b0cb52c6c -r cfbf6aa5c9e3 Python/ceval.c --- a/Python/ceval.c Sat Jun 16 21:49:08 2012 -0500 +++ b/Python/ceval.c Sun Jun 17 15:15:49 2012 +1000 @@ -1852,7 +1852,7 @@ PyObject *val; x = POP(); /* Remove iter from stack */ Py_DECREF(x); - err = PyGen_FetchStopIterationValue(&val); + err = _PyGen_FetchStopIterationValue(&val); if (err < 0) { x = NULL; break; /ncoghlan@gmail.com