mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-17 11:32:21 +03:00
Fix generator iteration
This commit is contained in:
parent
780eebde96
commit
59d21041ba
|
@ -2653,6 +2653,10 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
|
||||||
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
|
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
|
||||||
Py_UCS4 max_char);
|
Py_UCS4 max_char);
|
||||||
|
|
||||||
|
/* IterNext.proto */
|
||||||
|
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
|
||||||
|
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);
|
||||||
|
|
||||||
/* Import.proto */
|
/* Import.proto */
|
||||||
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
|
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
|
||||||
|
|
||||||
|
@ -3158,7 +3162,6 @@ static const char __pyx_k_load[] = "load";
|
||||||
static const char __pyx_k_main[] = "__main__";
|
static const char __pyx_k_main[] = "__main__";
|
||||||
static const char __pyx_k_memo[] = "memo";
|
static const char __pyx_k_memo[] = "memo";
|
||||||
static const char __pyx_k_name[] = "__name__";
|
static const char __pyx_k_name[] = "__name__";
|
||||||
static const char __pyx_k_next[] = "__next__";
|
|
||||||
static const char __pyx_k_node[] = "node";
|
static const char __pyx_k_node[] = "node";
|
||||||
static const char __pyx_k_open[] = "open";
|
static const char __pyx_k_open[] = "open";
|
||||||
static const char __pyx_k_path[] = "path";
|
static const char __pyx_k_path[] = "path";
|
||||||
|
@ -3731,7 +3734,6 @@ static PyObject *__pyx_n_s_module;
|
||||||
static PyObject *__pyx_n_s_name;
|
static PyObject *__pyx_n_s_name;
|
||||||
static PyObject *__pyx_n_s_name_2;
|
static PyObject *__pyx_n_s_name_2;
|
||||||
static PyObject *__pyx_n_s_new;
|
static PyObject *__pyx_n_s_new;
|
||||||
static PyObject *__pyx_n_s_next;
|
|
||||||
static PyObject *__pyx_n_s_node;
|
static PyObject *__pyx_n_s_node;
|
||||||
static PyObject *__pyx_n_s_obj;
|
static PyObject *__pyx_n_s_obj;
|
||||||
static PyObject *__pyx_n_s_object;
|
static PyObject *__pyx_n_s_object;
|
||||||
|
@ -48761,27 +48763,12 @@ static PyObject *__pyx_f_19dependency_injector_9providers_8Resource__provide(str
|
||||||
/* "dependency_injector/providers.pyx":2731
|
/* "dependency_injector/providers.pyx":2731
|
||||||
* self.__kwargs_len,
|
* self.__kwargs_len,
|
||||||
* )
|
* )
|
||||||
* self.__resource = initializer.__next__() # <<<<<<<<<<<<<<
|
* self.__resource = next(initializer) # <<<<<<<<<<<<<<
|
||||||
* self.__shutdowner = initializer.send
|
* self.__shutdowner = initializer.send
|
||||||
* elif callable(self.__initializer):
|
* elif callable(self.__initializer):
|
||||||
*/
|
*/
|
||||||
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_initializer, __pyx_n_s_next); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2731, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_initializer); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2731, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_3);
|
|
||||||
__pyx_t_2 = NULL;
|
|
||||||
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
|
|
||||||
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
|
|
||||||
if (likely(__pyx_t_2)) {
|
|
||||||
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
|
|
||||||
__Pyx_INCREF(__pyx_t_2);
|
|
||||||
__Pyx_INCREF(function);
|
|
||||||
__Pyx_DECREF_SET(__pyx_t_3, function);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
|
|
||||||
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
||||||
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2731, __pyx_L1_error)
|
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
||||||
__Pyx_GIVEREF(__pyx_t_1);
|
__Pyx_GIVEREF(__pyx_t_1);
|
||||||
__Pyx_GOTREF(__pyx_v_self->__pyx___resource);
|
__Pyx_GOTREF(__pyx_v_self->__pyx___resource);
|
||||||
__Pyx_DECREF(__pyx_v_self->__pyx___resource);
|
__Pyx_DECREF(__pyx_v_self->__pyx___resource);
|
||||||
|
@ -48790,7 +48777,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_8Resource__provide(str
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":2732
|
/* "dependency_injector/providers.pyx":2732
|
||||||
* )
|
* )
|
||||||
* self.__resource = initializer.__next__()
|
* self.__resource = next(initializer)
|
||||||
* self.__shutdowner = initializer.send # <<<<<<<<<<<<<<
|
* self.__shutdowner = initializer.send # <<<<<<<<<<<<<<
|
||||||
* elif callable(self.__initializer):
|
* elif callable(self.__initializer):
|
||||||
* self.__resource = __call(
|
* self.__resource = __call(
|
||||||
|
@ -48814,7 +48801,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_8Resource__provide(str
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":2733
|
/* "dependency_injector/providers.pyx":2733
|
||||||
* self.__resource = initializer.__next__()
|
* self.__resource = next(initializer)
|
||||||
* self.__shutdowner = initializer.send
|
* self.__shutdowner = initializer.send
|
||||||
* elif callable(self.__initializer): # <<<<<<<<<<<<<<
|
* elif callable(self.__initializer): # <<<<<<<<<<<<<<
|
||||||
* self.__resource = __call(
|
* self.__resource = __call(
|
||||||
|
@ -48876,7 +48863,7 @@ static PyObject *__pyx_f_19dependency_injector_9providers_8Resource__provide(str
|
||||||
__pyx_t_6 = 0;
|
__pyx_t_6 = 0;
|
||||||
|
|
||||||
/* "dependency_injector/providers.pyx":2733
|
/* "dependency_injector/providers.pyx":2733
|
||||||
* self.__resource = initializer.__next__()
|
* self.__resource = next(initializer)
|
||||||
* self.__shutdowner = initializer.send
|
* self.__shutdowner = initializer.send
|
||||||
* elif callable(self.__initializer): # <<<<<<<<<<<<<<
|
* elif callable(self.__initializer): # <<<<<<<<<<<<<<
|
||||||
* self.__resource = __call(
|
* self.__resource = __call(
|
||||||
|
@ -90321,7 +90308,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
||||||
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
|
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
|
{&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
|
{&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
|
|
||||||
{&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
|
{&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
|
{&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
|
||||||
{&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
|
{&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
|
||||||
|
@ -95773,6 +95759,61 @@ bad:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IterNext */
|
||||||
|
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
|
||||||
|
PyObject* exc_type;
|
||||||
|
__Pyx_PyThreadState_declare
|
||||||
|
__Pyx_PyThreadState_assign
|
||||||
|
exc_type = __Pyx_PyErr_Occurred();
|
||||||
|
if (unlikely(exc_type)) {
|
||||||
|
if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
|
||||||
|
return NULL;
|
||||||
|
__Pyx_PyErr_Clear();
|
||||||
|
Py_INCREF(defval);
|
||||||
|
return defval;
|
||||||
|
}
|
||||||
|
if (defval) {
|
||||||
|
Py_INCREF(defval);
|
||||||
|
return defval;
|
||||||
|
}
|
||||||
|
__Pyx_PyErr_SetNone(PyExc_StopIteration);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
|
||||||
|
PyErr_Format(PyExc_TypeError,
|
||||||
|
"%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
|
||||||
|
}
|
||||||
|
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
|
||||||
|
PyObject* next;
|
||||||
|
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
|
||||||
|
if (likely(iternext)) {
|
||||||
|
#if CYTHON_USE_TYPE_SLOTS
|
||||||
|
next = iternext(iterator);
|
||||||
|
if (likely(next))
|
||||||
|
return next;
|
||||||
|
#if PY_VERSION_HEX >= 0x02070000
|
||||||
|
if (unlikely(iternext == &_PyObject_NextNotImplemented))
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
next = PyIter_Next(iterator);
|
||||||
|
if (likely(next))
|
||||||
|
return next;
|
||||||
|
#endif
|
||||||
|
} else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
|
||||||
|
__Pyx_PyIter_Next_ErrorNoIterator(iterator);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#if !CYTHON_USE_TYPE_SLOTS
|
||||||
|
else {
|
||||||
|
next = PyIter_Next(iterator);
|
||||||
|
if (likely(next))
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return __Pyx_PyIter_Next2Default(defval);
|
||||||
|
}
|
||||||
|
|
||||||
/* Import */
|
/* Import */
|
||||||
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
|
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
|
||||||
PyObject *empty_list = 0;
|
PyObject *empty_list = 0;
|
||||||
|
|
|
@ -2728,7 +2728,7 @@ cdef class Resource(Provider):
|
||||||
self.__kwargs,
|
self.__kwargs,
|
||||||
self.__kwargs_len,
|
self.__kwargs_len,
|
||||||
)
|
)
|
||||||
self.__resource = initializer.__next__()
|
self.__resource = next(initializer)
|
||||||
self.__shutdowner = initializer.send
|
self.__shutdowner = initializer.send
|
||||||
elif callable(self.__initializer):
|
elif callable(self.__initializer):
|
||||||
self.__resource = __call(
|
self.__resource = __call(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user