]> granicus.if.org Git - python/commitdiff
Issue #13783: the PEP 380 implementation no longer expands the public C API
authorNick Coghlan <ncoghlan@gmail.com>
Sun, 17 Jun 2012 05:15:49 +0000 (15:15 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Sun, 17 Jun 2012 05:15:49 +0000 (15:15 +1000)
Include/genobject.h
Include/pyerrors.h
Misc/NEWS
Objects/exceptions.c
Objects/genobject.c
Python/ceval.c

index 25f6c33d1cc5484c23c06085904d4887bd92fb95..ed451baf3cb0feb45184c4e03d91b10ed6a63ae8 100644 (file)
@@ -34,7 +34,7 @@ PyAPI_DATA(PyTypeObject) PyGen_Type;
 
 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
index cfae92232f2c64dd6495a48b39087f6e37df6734..2c145ada358fff638b5b15e259fbe43029b3aa10 100644 (file)
@@ -400,9 +400,6 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
     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
index 6c587af1e25d0fff7c4742ce355b76309bc5965d..5a5813b64447029bddb6bc3bdd31099920cec27c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -111,6 +111,12 @@ Library
 - 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
 -----------------
 
index 9e10b7e30763641b360d29b556a42a8202d6d380..f70669849994e47a3a3008b765f456d079a29651 100644 (file)
@@ -516,12 +516,6 @@ StopIteration_traverse(PyStopIterationObject *self, visitproc visit, void *arg)
     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 */
index 8c70b5ca1000db9ace303d789d1f1240e0f853b4..6018e5b1a0c87f2d5b195f7c2d6ea663f2899ece 100644 (file)
@@ -97,7 +97,8 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
             /* 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 @@ gen_throw(PyGenObject *gen, PyObject *args)
             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 @@ gen_iternext(PyGenObject *gen)
  */
 
 int
-PyGen_FetchStopIterationValue(PyObject **pvalue) {
+_PyGen_FetchStopIterationValue(PyObject **pvalue) {
     PyObject *et, *ev, *tb;
     PyObject *value = NULL;
 
index b3ec013e1711c04a6b4fb923f4e2005a9fbe8bab..7e9318bc0b38c82c5804d746e300d63cbca92d43 100644 (file)
@@ -1852,7 +1852,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
                 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;