{
struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self;
PyObject *retval;
+#if PY_VERSION_HEX < 0x02050000
+ PyErr_SetNone(PyExc_StopIteration);
+#else
PyErr_SetNone(PyExc_GeneratorExit);
+#endif
retval = __Pyx_Generator_SendEx(generator, NULL);
if (retval) {
Py_DECREF(retval);
"generator ignored GeneratorExit");
return NULL;
}
+#if PY_VERSION_HEX < 0x02050000
+ if (PyErr_ExceptionMatches(PyExc_StopIteration))
+#else
if (PyErr_ExceptionMatches(PyExc_StopIteration)
|| PyErr_ExceptionMatches(PyExc_GeneratorExit))
+#endif
{
PyErr_Clear(); /* ignore these errors */
Py_INCREF(Py_None);
]),
(2,5) : (operator.lt, lambda x: x in ['run.any',
'run.all',
- 'run.generators',
]),
(2,6) : (operator.lt, lambda x: x in ['run.print_function',
'run.cython3',
def next(it):
return it.next()
+if hasattr(__builtins__, 'GeneratorExit'):
+ GeneratorExit = __builtins__.GeneratorExit
+else: # < 2.5
+ GeneratorExit = StopIteration
+
def very_simple():
"""
>>> x = very_simple()