Commit eca81040 authored by Stefan Behnel's avatar Stefan Behnel

move error handling out of inlined function

parent 3f9c82d5
...@@ -5,6 +5,13 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject ...@@ -5,6 +5,13 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject
//////////////////// GeneratorYieldFrom //////////////////// //////////////////// GeneratorYieldFrom ////////////////////
//@requires: Generator //@requires: Generator
static void __PyxPyIter_CheckErrorAndDecref(PyObject *source) {
PyErr_Format(PyExc_TypeError,
"iter() returned non-iterator of type '%.100s'",
Py_TYPE(source)->tp_name);
Py_DECREF(source);
}
static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) { static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source) {
PyObject *source_gen, *retval; PyObject *source_gen, *retval;
#ifdef __Pyx_Coroutine_USED #ifdef __Pyx_Coroutine_USED
...@@ -22,13 +29,11 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject ...@@ -22,13 +29,11 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject
if (unlikely(!source_gen)) if (unlikely(!source_gen))
return NULL; return NULL;
if (unlikely(!PyIter_Check(source_gen))) { if (unlikely(!PyIter_Check(source_gen))) {
PyErr_Format(PyExc_TypeError, __PyxPyIter_CheckErrorAndDecref(source_gen);
"iter() returned non-iterator of type '%.100s'",
Py_TYPE(source_gen)->tp_name);
Py_DECREF(source_gen);
return NULL; return NULL;
} }
} else } else
// CPython also allows non-iterable sequences to be iterated over
#endif #endif
{ {
source_gen = PyObject_GetIter(source); source_gen = PyObject_GetIter(source);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment