Generated by Cython 0.29.2

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: _imap.c

+001: # -*- coding: utf-8 -*-
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 002: # Copyright (c) 2018 gevent
 003: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False,infer_types=True
 004: 
 005: """
 006: Iterators across greenlets or AsyncResult objects.
 007: 
 008: """
 009: from __future__ import absolute_import
 010: from __future__ import division
 011: from __future__ import print_function
 012: 
 013: 
+014: from gevent import _semaphore
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_semaphore);
  __Pyx_GIVEREF(__pyx_n_s_semaphore);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_semaphore);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_semaphore); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_semaphore, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+015: from gevent import queue
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_queue);
  __Pyx_GIVEREF(__pyx_n_s_queue);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_queue);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_queue, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 016: 
 017: 
+018: __all__ = [
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_IMapUnordered);
  __Pyx_GIVEREF(__pyx_n_s_IMapUnordered);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_IMapUnordered);
  __Pyx_INCREF(__pyx_n_s_IMap);
  __Pyx_GIVEREF(__pyx_n_s_IMap);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_IMap);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 019:     'IMapUnordered',
 020:     'IMap',
 021: ]
 022: 
+023: locals()['Greenlet'] = __import__('gevent').Greenlet
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Greenlet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_Greenlet, __pyx_t_2) < 0)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_gevent); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
+024: locals()['Semaphore'] = _semaphore.Semaphore
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_semaphore); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Semaphore); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyDict_SetItem(__pyx_t_2, __pyx_n_s_Semaphore, __pyx_t_1) < 0)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+025: locals()['UnboundQueue'] = queue.UnboundQueue
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UnboundQueue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_UnboundQueue, __pyx_t_2) < 0)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 026: 
 027: 
 028: class Failure(object):
+029:     __slots__ = ('exc', 'raise_exception')
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6__imap_Failure->tp_dict, __pyx_n_s_slots, __pyx_tuple__2) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_6gevent_6__imap_Failure);
/* … */
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_exc, __pyx_n_s_raise_exception); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
 030: 
+031:     def __init__(self, exc, raise_exception=None):
/* Python wrapper */
static int __pyx_pw_6gevent_6__imap_7Failure_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_6__imap_7Failure_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_exc = 0;
  PyObject *__pyx_v_raise_exception = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc,&__pyx_n_s_raise_exception,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_raise_exception);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 31, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_exc = values[0];
    __pyx_v_raise_exception = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 31, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("gevent.__imap.Failure.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6gevent_6__imap_7Failure___init__(((struct __pyx_obj_6gevent_6__imap_Failure *)__pyx_v_self), __pyx_v_exc, __pyx_v_raise_exception);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6gevent_6__imap_7Failure___init__(struct __pyx_obj_6gevent_6__imap_Failure *__pyx_v_self, PyObject *__pyx_v_exc, PyObject *__pyx_v_raise_exception) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+032:         self.exc = exc
  __Pyx_INCREF(__pyx_v_exc);
  __Pyx_GIVEREF(__pyx_v_exc);
  __Pyx_GOTREF(__pyx_v_self->exc);
  __Pyx_DECREF(__pyx_v_self->exc);
  __pyx_v_self->exc = __pyx_v_exc;
+033:         self.raise_exception = raise_exception
  __Pyx_INCREF(__pyx_v_raise_exception);
  __Pyx_GIVEREF(__pyx_v_raise_exception);
  __Pyx_GOTREF(__pyx_v_self->raise_exception);
  __Pyx_DECREF(__pyx_v_self->raise_exception);
  __pyx_v_self->raise_exception = __pyx_v_raise_exception;
 034: 
 035: 
+036: def _raise_exc(failure):
static CYTHON_INLINE PyObject *__pyx_f_6gevent_6__imap__raise_exc(struct __pyx_obj_6gevent_6__imap_Failure *__pyx_v_failure) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_raise_exc", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__imap._raise_exc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 037:     # For cython.
+038:     if failure.raise_exception:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_failure->raise_exception); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
  if (likely(__pyx_t_1)) {
/* … */
    goto __pyx_L3;
  }
+039:         failure.raise_exception()
    __Pyx_INCREF(__pyx_v_failure->raise_exception);
    __pyx_t_3 = __pyx_v_failure->raise_exception; __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 040:     else:
+041:         raise failure.exc
  /*else*/ {
    __Pyx_Raise(__pyx_v_failure->exc, 0, 0, 0);
    __PYX_ERR(0, 41, __pyx_L1_error)
  }
  __pyx_L3:;
 042: 
+043: class IMapUnordered(Greenlet): # pylint:disable=undefined-variable
struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered {
  struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet __pyx_base;
  PyObject *(*_inext)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *);
  PyObject *(*_ispawn)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *, PyObject *, int);
  PyObject *(*_on_result)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_on_finish)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *);
  PyObject *(*_iqueue_value_for_success)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *);
  PyObject *(*_iqueue_value_for_failure)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *);
  PyObject *(*_iqueue_value_for_self_finished)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *);
  PyObject *(*_iqueue_value_for_self_failure)(struct __pyx_obj_6gevent_6__imap_IMapUnordered *, PyObject *);
};
static struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *__pyx_vtabptr_6gevent_6__imap_IMapUnordered;

 044:     """
 045:     At iterator of map results.
 046:     """
 047: 
+048:     def __init__(self, func, iterable, spawn, maxsize=None, _zipped=False):
/* Python wrapper */
static int __pyx_pw_6gevent_6__imap_13IMapUnordered_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6gevent_6__imap_13IMapUnordered___init__[] = "\n        An iterator that.\n\n        :param callable spawn: The function we use to create new greenlets.\n        :keyword int maxsize: If given and not-None, specifies the maximum number of\n            finished results that will be allowed to accumulated awaiting the reader;\n            more than that number of results will cause map function greenlets to begin\n            to block. This is most useful is there is a great disparity in the speed of\n            the mapping code and the consumer and the results consume a great deal of resources.\n            Using a bound is more computationally expensive than not using a bound.\n\n        .. versionchanged:: 1.1b3\n            Added the *maxsize* parameter.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6gevent_6__imap_13IMapUnordered___init__;
#endif
static int __pyx_pw_6gevent_6__imap_13IMapUnordered_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_iterable = 0;
  PyObject *__pyx_v_spawn = 0;
  PyObject *__pyx_v_maxsize = 0;
  PyObject *__pyx_v__zipped = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func,&__pyx_n_s_iterable,&__pyx_n_s_spawn,&__pyx_n_s_maxsize,&__pyx_n_s_zipped,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_func)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_iterable)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 1); __PYX_ERR(0, 48, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_spawn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, 2); __PYX_ERR(0, 48, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zipped);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 48, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_func = values[0];
    __pyx_v_iterable = values[1];
    __pyx_v_spawn = values[2];
    __pyx_v_maxsize = values[3];
    __pyx_v__zipped = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 48, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6gevent_6__imap_13IMapUnordered___init__(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self), __pyx_v_func, __pyx_v_iterable, __pyx_v_spawn, __pyx_v_maxsize, __pyx_v__zipped);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6gevent_6__imap_13IMapUnordered___init__(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_iterable, PyObject *__pyx_v_spawn, PyObject *__pyx_v_maxsize, PyObject *__pyx_v__zipped) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 049:         """
 050:         An iterator that.
 051: 
 052:         :param callable spawn: The function we use to create new greenlets.
 053:         :keyword int maxsize: If given and not-None, specifies the maximum number of
 054:             finished results that will be allowed to accumulated awaiting the reader;
 055:             more than that number of results will cause map function greenlets to begin
 056:             to block. This is most useful is there is a great disparity in the speed of
 057:             the mapping code and the consumer and the results consume a great deal of resources.
 058:             Using a bound is more computationally expensive than not using a bound.
 059: 
 060:         .. versionchanged:: 1.1b3
 061:             Added the *maxsize* parameter.
 062:         """
+063:         Greenlet.__init__(self) # pylint:disable=undefined-variable
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self));
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+064:         self.spawn = spawn
  __Pyx_INCREF(__pyx_v_spawn);
  __Pyx_GIVEREF(__pyx_v_spawn);
  __Pyx_GOTREF(__pyx_v_self->spawn);
  __Pyx_DECREF(__pyx_v_self->spawn);
  __pyx_v_self->spawn = __pyx_v_spawn;
+065:         self._zipped = _zipped
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v__zipped); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error)
  __pyx_v_self->_zipped = __pyx_t_4;
+066:         self.func = func
  __Pyx_INCREF(__pyx_v_func);
  __Pyx_GIVEREF(__pyx_v_func);
  __Pyx_GOTREF(__pyx_v_self->func);
  __Pyx_DECREF(__pyx_v_self->func);
  __pyx_v_self->func = __pyx_v_func;
+067:         self.iterable = iterable
  __Pyx_INCREF(__pyx_v_iterable);
  __Pyx_GIVEREF(__pyx_v_iterable);
  __Pyx_GOTREF(__pyx_v_self->iterable);
  __Pyx_DECREF(__pyx_v_self->iterable);
  __pyx_v_self->iterable = __pyx_v_iterable;
+068:         self.queue = UnboundQueue() # pylint:disable=undefined-variable
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_6_queue_UnboundQueue)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->queue);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->queue));
  __pyx_v_self->queue = ((struct __pyx_obj_6gevent_6_queue_UnboundQueue *)__pyx_t_1);
  __pyx_t_1 = 0;
 069: 
 070: 
+071:         if maxsize:
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_maxsize); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 71, __pyx_L1_error)
  if (__pyx_t_4) {
/* … */
    goto __pyx_L3;
  }
 072:             # Bounding the queue is not enough if we want to keep from
 073:             # accumulating objects; the result value will be around as
 074:             # the greenlet's result, blocked on self.queue.put(), and
 075:             # we'll go on to spawn another greenlet, which in turn can
 076:             # create the result. So we need a semaphore to prevent a
 077:             # greenlet from exiting while the queue is full so that we
 078:             # don't spawn the next greenlet (assuming that self.spawn
 079:             # is of course bounded). (Alternatively we could have the
 080:             # greenlet itself do the insert into the pool, but that
 081:             # takes some rework).
 082:             #
 083:             # Given the use of a semaphore at this level, sizing the queue becomes
 084:             # redundant, and that lets us avoid having to use self.link() instead
 085:             # of self.rawlink() to avoid having blocking methods called in the
 086:             # hub greenlet.
+087:             self._result_semaphore = Semaphore(maxsize) # pylint:disable=undefined-variable
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_6gevent_11__semaphore_Semaphore), __pyx_v_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->_result_semaphore);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_result_semaphore));
    __pyx_v_self->_result_semaphore = ((struct __pyx_obj_6gevent_11__semaphore_Semaphore *)__pyx_t_1);
    __pyx_t_1 = 0;
 088:         else:
+089:             self._result_semaphore = None
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->_result_semaphore);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->_result_semaphore));
    __pyx_v_self->_result_semaphore = ((struct __pyx_obj_6gevent_11__semaphore_Semaphore *)Py_None);
  }
  __pyx_L3:;
 090: 
+091:         self._outstanding_tasks = 0
  __pyx_v_self->_outstanding_tasks = 0;
 092:         # The index (zero based) of the maximum number of
 093:         # results we will have.
+094:         self._max_index = -1
  __pyx_v_self->_max_index = -1;
+095:         self.finished = False
  __pyx_v_self->finished = 0;
 096: 
 097: 
 098:     # We're iterating in a different greenlet than we're running.
+099:     def __iter__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_6__imap_13IMapUnordered_2__iter__(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6gevent_6__imap_13IMapUnordered_2__iter__(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+100:         return self
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;
 101: 
+102:     def __next__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_6__imap_13IMapUnordered_4__next__(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6gevent_6__imap_13IMapUnordered_4__next__(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+103:         if self._result_semaphore is not None:
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_result_semaphore) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
/* … */
  }
+104:             self._result_semaphore.release()
    __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_11__semaphore_Semaphore *)__pyx_v_self->_result_semaphore->__pyx_base.__pyx_vtab)->release(__pyx_v_self->_result_semaphore, 0); if (unlikely(__pyx_t_3 == ((int)-1000))) __PYX_ERR(0, 104, __pyx_L1_error)
+105:         value = self._inext()
  __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_inext(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_value = __pyx_t_4;
  __pyx_t_4 = 0;
+106:         if isinstance(value, Failure):
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_6gevent_6__imap_Failure); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {
/* … */
  }
+107:             _raise_exc(value)
    if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6gevent_6__imap_Failure))))) __PYX_ERR(0, 107, __pyx_L1_error)
    __pyx_t_4 = __pyx_f_6gevent_6__imap__raise_exc(((struct __pyx_obj_6gevent_6__imap_Failure *)__pyx_v_value)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+108:         return value
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;
 109: 
+110:     next = __next__ # Py2
  __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6gevent_6__imap_IMapUnordered, __pyx_n_s_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6__imap_IMapUnordered->tp_dict, __pyx_n_s_next_2, __pyx_t_2) < 0) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_6gevent_6__imap_IMapUnordered);
 111: 
+112:     def _inext(self):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__inext(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_inext", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._inext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+113:         return self.queue.get()
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 114: 
+115:     def _ispawn(self, func, item, item_index):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__ispawn(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_item, int __pyx_v_item_index) {
  PyObject *__pyx_v_g = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ispawn", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._ispawn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+116:         if self._result_semaphore is not None:
  __pyx_t_1 = (((PyObject *)__pyx_v_self->_result_semaphore) != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
/* … */
  }
+117:             self._result_semaphore.acquire()
    __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_11__semaphore_Semaphore *)__pyx_v_self->_result_semaphore->__pyx_base.__pyx_vtab)->acquire(__pyx_v_self->_result_semaphore, 0, NULL); if (unlikely(__pyx_t_2 == ((int)-1000))) __PYX_ERR(0, 117, __pyx_L1_error)
+118:         self._outstanding_tasks += 1
  __pyx_v_self->_outstanding_tasks = (__pyx_v_self->_outstanding_tasks + 1);
+119:         g = self.spawn(func, item) if not self._zipped else self.spawn(func, *item)
  if (((!(__pyx_v_self->_zipped != 0)) != 0)) {
    __Pyx_INCREF(__pyx_v_self->spawn);
    __pyx_t_5 = __pyx_v_self->spawn; __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_func, __pyx_v_item};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_func, __pyx_v_item};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_v_func);
      __Pyx_GIVEREF(__pyx_v_func);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_func);
      __Pyx_INCREF(__pyx_v_item);
      __Pyx_GIVEREF(__pyx_v_item);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_item);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_func);
    __Pyx_GIVEREF(__pyx_v_func);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_func);
    __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_v_item); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_self->spawn, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_v_g = __pyx_t_3;
  __pyx_t_3 = 0;
+120:         g._imap_task_index = item_index
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_item_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_g, __pyx_n_s_imap_task_index, __pyx_t_3) < 0) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+121:         g.rawlink(self._on_result)
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_rawlink); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_result); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+122:         return g
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_g);
  __pyx_r = __pyx_v_g;
  goto __pyx_L0;
 123: 
+124:     def _run(self): # pylint:disable=method-hidden
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_7_run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6gevent_6__imap_13IMapUnordered_6_run[] = "IMapUnordered._run(self)";
static PyMethodDef __pyx_mdef_6gevent_6__imap_13IMapUnordered_7_run = {"_run", (PyCFunction)__pyx_pw_6gevent_6__imap_13IMapUnordered_7_run, METH_NOARGS, __pyx_doc_6gevent_6__imap_13IMapUnordered_6_run};
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_7_run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_run (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_6__imap_13IMapUnordered_6_run(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6gevent_6__imap_13IMapUnordered_6_run(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self) {
  PyObject *__pyx_v_func = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_run", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_func);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__3 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_func, __pyx_n_s_item, __pyx_n_s_e); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6__imap_13IMapUnordered_7_run, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IMapUnordered__run, NULL, __pyx_n_s_gevent___imap, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6__imap_IMapUnordered->tp_dict, __pyx_n_s_run, __pyx_t_2) < 0) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_6gevent_6__imap_IMapUnordered);
  __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__imap_py, __pyx_n_s_run, 124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 124, __pyx_L1_error)
+125:         try:
  /*try:*/ {
    {
      /*try:*/ {
/* … */
      }
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L11_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* … */
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
      goto __pyx_L4_error;
      __pyx_L11_try_end:;
    }
  }
+126:             func = self.func
        __pyx_t_4 = __pyx_v_self->func;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_func = __pyx_t_4;
        __pyx_t_4 = 0;
+127:             for item in self.iterable:
        if (likely(PyList_CheckExact(__pyx_v_self->iterable)) || PyTuple_CheckExact(__pyx_v_self->iterable)) {
          __pyx_t_4 = __pyx_v_self->iterable; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
          __pyx_t_6 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_self->iterable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L6_error)
        }
        for (;;) {
          if (likely(!__pyx_t_6)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 127, __pyx_L6_error)
              #else
              __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 127, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_7);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 127, __pyx_L6_error)
              #else
              __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 127, __pyx_L6_error)
              __Pyx_GOTREF(__pyx_t_7);
              #endif
            }
          } else {
            __pyx_t_7 = __pyx_t_6(__pyx_t_4);
            if (unlikely(!__pyx_t_7)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 127, __pyx_L6_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_7);
          }
          __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
          __pyx_t_7 = 0;
/* … */
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+128:                 self._max_index += 1
          __pyx_v_self->_max_index = (__pyx_v_self->_max_index + 1);
+129:                 self._ispawn(func, item, self._max_index)
          __pyx_t_7 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_ispawn(__pyx_v_self, __pyx_v_func, __pyx_v_item, __pyx_v_self->_max_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L6_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+130:             self._on_finish(None)
        __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_finish(__pyx_v_self, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+131:         except BaseException as e:
      __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_BaseException);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("gevent.__imap.IMapUnordered._run", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_9) < 0) __PYX_ERR(0, 131, __pyx_L8_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __pyx_v_e = __pyx_t_7;
        /*try:*/ {
/* … */
        /*finally:*/ {
          __pyx_L19_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_13);
            __Pyx_XGOTREF(__pyx_t_14);
            __Pyx_XGOTREF(__pyx_t_15);
            __Pyx_XGOTREF(__pyx_t_16);
            __Pyx_XGOTREF(__pyx_t_17);
            __Pyx_XGOTREF(__pyx_t_18);
            __pyx_t_8 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_e);
              __pyx_v_e = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_16);
              __Pyx_XGIVEREF(__pyx_t_17);
              __Pyx_XGIVEREF(__pyx_t_18);
              __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
            }
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_XGIVEREF(__pyx_t_14);
            __Pyx_XGIVEREF(__pyx_t_15);
            __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
            __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
            __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
            goto __pyx_L8_except_error;
          }
        }
      }
      goto __pyx_L8_except_error;
      __pyx_L8_except_error:;
+132:             self._on_finish(e)
          __pyx_t_10 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_on_finish(__pyx_v_self, __pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 132, __pyx_L19_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+133:             raise
          __Pyx_GIVEREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_7, __pyx_t_9);
          __pyx_t_4 = 0; __pyx_t_7 = 0; __pyx_t_9 = 0; 
          __PYX_ERR(0, 133, __pyx_L19_error)
        }
 134:         finally:
+135:             self.spawn = None
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->spawn);
      __Pyx_DECREF(__pyx_v_self->spawn);
      __pyx_v_self->spawn = Py_None;
/* … */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->spawn);
        __Pyx_DECREF(__pyx_v_self->spawn);
        __pyx_v_self->spawn = Py_None;
+136:             self.func = None
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->func);
      __Pyx_DECREF(__pyx_v_self->func);
      __pyx_v_self->func = Py_None;
/* … */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->func);
        __Pyx_DECREF(__pyx_v_self->func);
        __pyx_v_self->func = Py_None;
+137:             self.iterable = None
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->iterable);
      __Pyx_DECREF(__pyx_v_self->iterable);
      __pyx_v_self->iterable = Py_None;
/* … */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->iterable);
        __Pyx_DECREF(__pyx_v_self->iterable);
        __pyx_v_self->iterable = Py_None;
+138:             self._result_semaphore = None
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_result_semaphore);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->_result_semaphore));
      __pyx_v_self->_result_semaphore = ((struct __pyx_obj_6gevent_11__semaphore_Semaphore *)Py_None);
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0)) __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_11 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_19 = __pyx_filename;
      {
/* … */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_result_semaphore);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->_result_semaphore));
        __pyx_v_self->_result_semaphore = ((struct __pyx_obj_6gevent_11__semaphore_Semaphore *)Py_None);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1);
      __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_19;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }
 139: 
+140:     def _on_result(self, greenlet):
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_9_on_result(PyObject *__pyx_v_self, PyObject *__pyx_v_greenlet); /*proto*/
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__on_result(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_greenlet, int __pyx_skip_dispatch) {
  int __pyx_v_count;
  int __pyx_v_finished;
  int __pyx_v_ready;
  int __pyx_v_put_finished;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_result", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
    if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
    else {
      PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_on_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6__imap_13IMapUnordered_9_on_result)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_greenlet) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_greenlet);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
      tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
      if (unlikely(type_dict_guard != tp_dict_version)) {
        tp_dict_version = obj_dict_version = 0;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    }
    #endif
  }
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._on_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_9_on_result(PyObject *__pyx_v_self, PyObject *__pyx_v_greenlet); /*proto*/
static char __pyx_doc_6gevent_6__imap_13IMapUnordered_8_on_result[] = "IMapUnordered._on_result(self, greenlet)";
static PyMethodDef __pyx_mdef_6gevent_6__imap_13IMapUnordered_9_on_result = {"_on_result", (PyCFunction)__pyx_pw_6gevent_6__imap_13IMapUnordered_9_on_result, METH_O, __pyx_doc_6gevent_6__imap_13IMapUnordered_8_on_result};
static PyObject *__pyx_pw_6gevent_6__imap_13IMapUnordered_9_on_result(PyObject *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_result (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_6__imap_13IMapUnordered_8_on_result(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self), ((PyObject *)__pyx_v_greenlet));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6gevent_6__imap_13IMapUnordered_8_on_result(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_result", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6gevent_6__imap_13IMapUnordered__on_result(__pyx_v_self, __pyx_v_greenlet, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._on_result", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6__imap_13IMapUnordered_9_on_result, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_IMapUnordered__on_result, NULL, __pyx_n_s_gevent___imap, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6__imap_IMapUnordered->tp_dict, __pyx_n_s_on_result, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_6gevent_6__imap_IMapUnordered);
 141:         # This method will be called in the hub greenlet (we rawlink)
+142:         self._outstanding_tasks -= 1
  __pyx_v_self->_outstanding_tasks = (__pyx_v_self->_outstanding_tasks - 1);
+143:         count = self._outstanding_tasks
  __pyx_t_5 = __pyx_v_self->_outstanding_tasks;
  __pyx_v_count = __pyx_t_5;
+144:         finished = self.finished
  __pyx_t_6 = __pyx_v_self->finished;
  __pyx_v_finished = __pyx_t_6;
+145:         ready = self.ready()
  __pyx_v_ready = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.ready(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), 0);
+146:         put_finished = False
  __pyx_v_put_finished = 0;
 147: 
+148:         if ready and count <= 0 and not finished:
  __pyx_t_7 = (__pyx_v_ready != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_count <= 0) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = ((!(__pyx_v_finished != 0)) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {
/* … */
  }
+149:             finished = self.finished = True
    __pyx_v_finished = 1;
    __pyx_v_self->finished = 1;
+150:             put_finished = True
    __pyx_v_put_finished = 1;
 151: 
+152:         if greenlet.successful():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_greenlet, __pyx_n_s_successful); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {
/* … */
    goto __pyx_L7;
  }
+153:             self.queue.put(self._iqueue_value_for_success(greenlet))
    __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_iqueue_value_for_success(__pyx_v_self, __pyx_v_greenlet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), __pyx_t_1, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 154:         else:
+155:             self.queue.put(self._iqueue_value_for_failure(greenlet))
  /*else*/ {
    __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_iqueue_value_for_failure(__pyx_v_self, __pyx_v_greenlet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), __pyx_t_2, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L7:;
 156: 
+157:         if put_finished:
  __pyx_t_6 = (__pyx_v_put_finished != 0);
  if (__pyx_t_6) {
/* … */
  }
+158:             self.queue.put(self._iqueue_value_for_self_finished())
    __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_iqueue_value_for_self_finished(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), __pyx_t_1, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 159: 
+160:     def _on_finish(self, exception):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__on_finish(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_on_finish", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._on_finish", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 161:         # Called in this greenlet.
+162:         if self.finished:
  __pyx_t_1 = (__pyx_v_self->finished != 0);
  if (__pyx_t_1) {
/* … */
  }
+163:             return
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
 164: 
+165:         if exception is not None:
  __pyx_t_1 = (__pyx_v_exception != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {
/* … */
  }
+166:             self.finished = True
    __pyx_v_self->finished = 1;
+167:             self.queue.put(self._iqueue_value_for_self_failure(exception))
    __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_iqueue_value_for_self_failure(__pyx_v_self, __pyx_v_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), __pyx_t_3, 0, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+168:             return
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
 169: 
+170:         if self._outstanding_tasks <= 0:
  __pyx_t_2 = ((__pyx_v_self->_outstanding_tasks <= 0) != 0);
  if (__pyx_t_2) {
/* … */
  }
+171:             self.finished = True
    __pyx_v_self->finished = 1;
+172:             self.queue.put(self._iqueue_value_for_self_finished())
    __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered *)__pyx_v_self->__pyx_base.__pyx_vtab)->_iqueue_value_for_self_finished(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->queue), __pyx_t_4, 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 173: 
+174:     def _iqueue_value_for_success(self, greenlet):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_success(CYTHON_UNUSED struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_success", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._iqueue_value_for_success", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+175:         return greenlet.value
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_greenlet, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 176: 
+177:     def _iqueue_value_for_failure(self, greenlet):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_failure(CYTHON_UNUSED struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_failure", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._iqueue_value_for_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+178:         return Failure(greenlet.exception, getattr(greenlet, '_raise_exception'))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_greenlet, __pyx_n_s_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_v_greenlet, __pyx_n_s_raise_exception_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6__imap_Failure), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 179: 
+180:     def _iqueue_value_for_self_finished(self):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_self_finished(CYTHON_UNUSED struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_self_finished", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._iqueue_value_for_self_finished", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+181:         return Failure(StopIteration())
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_StopIteration); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_6gevent_6__imap_Failure), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 182: 
+183:     def _iqueue_value_for_self_failure(self, exception):
static PyObject *__pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_self_failure(struct __pyx_obj_6gevent_6__imap_IMapUnordered *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_self_failure", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("gevent.__imap.IMapUnordered._iqueue_value_for_self_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+184:         return Failure(exception, self._raise_exception)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_exception_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_exception);
  __Pyx_GIVEREF(__pyx_v_exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_exception);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6__imap_Failure), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 185: 
 186: 
+187: class IMap(IMapUnordered):
struct __pyx_vtabstruct_6gevent_6__imap_IMap {
  struct __pyx_vtabstruct_6gevent_6__imap_IMapUnordered __pyx_base;
};
static struct __pyx_vtabstruct_6gevent_6__imap_IMap *__pyx_vtabptr_6gevent_6__imap_IMap;
 188:     # A specialization of IMapUnordered that returns items
 189:     # in the order in which they were generated, not
 190:     # the order in which they finish.
 191: 
+192:     def __init__(self, *args, **kwargs):
/* Python wrapper */
static int __pyx_pw_6gevent_6__imap_4IMap_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_6__imap_4IMap_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1;
  if (unlikely(__pyx_kwds)) {
    __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = NULL;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6gevent_6__imap_4IMap___init__(((struct __pyx_obj_6gevent_6__imap_IMap *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6gevent_6__imap_4IMap___init__(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMap.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 193:         # The result dictionary: {index: value}
+194:         self._results = {}
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_results);
  __Pyx_DECREF(__pyx_v_self->_results);
  __pyx_v_self->_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
 195: 
 196:         # The index of the result to return next.
+197:         self.index = 0
  __pyx_v_self->index = 0;
+198:         IMapUnordered.__init__(self, *args, **kwargs)
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_6__imap_IMapUnordered), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 199: 
+200:     def _inext(self):
static PyObject *__pyx_f_6gevent_6__imap_4IMap__inext(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self) {
  int __pyx_v_index;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_inext", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("gevent.__imap.IMap._inext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+201:         try:
  {
    /*try:*/ {
/* … */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* … */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L8_try_end:;
  }
+202:             value = self._results.pop(self.index)
      if (unlikely(__pyx_v_self->_results == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop");
        __PYX_ERR(0, 202, __pyx_L3_error)
      }
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyDict_Pop(__pyx_v_self->_results, __pyx_t_4, ((PyObject *)NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_value = __pyx_t_5;
      __pyx_t_5 = 0;
+203:         except KeyError:
    __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("gevent.__imap.IMap._inext", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 203, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
 204:             # Wait for our index to finish.
+205:             while 1:
      while (1) {
+206:                 index, value = self.queue.get()
        __pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->__pyx_base.queue->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_base.queue), 0, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
          PyObject* sequence = __pyx_t_8;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 206, __pyx_L5_except_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          #else
          __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 206, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 206, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          #endif
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_11 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 206, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
          index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L13_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_9);
          index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L13_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_10);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 206, __pyx_L5_except_error)
          __pyx_t_12 = NULL;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L14_unpacking_done;
          __pyx_L13_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_12 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 206, __pyx_L5_except_error)
          __pyx_L14_unpacking_done:;
        }
        __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L5_except_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_v_index = __pyx_t_6;
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10);
        __pyx_t_10 = 0;
+207:                 if index == self.index:
        __pyx_t_13 = ((__pyx_v_index == __pyx_v_self->index) != 0);
        if (__pyx_t_13) {
/* … */
        }
+208:                     break
          goto __pyx_L12_break;
 209:                 else:
+210:                     self._results[index] = value
        /*else*/ {
          if (unlikely(__pyx_v_self->_results == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 210, __pyx_L5_except_error)
          }
          __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 210, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (unlikely(PyDict_SetItem(__pyx_v_self->_results, __pyx_t_8, __pyx_v_value) < 0)) __PYX_ERR(0, 210, __pyx_L5_except_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __pyx_L12_break:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
+211:         self.index += 1
  __pyx_v_self->index = (__pyx_v_self->index + 1);
+212:         return value
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); __PYX_ERR(0, 212, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;
 213: 
+214:     def _iqueue_value_for_success(self, greenlet):
static PyObject *__pyx_f_6gevent_6__imap_4IMap__iqueue_value_for_success(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_success", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMap._iqueue_value_for_success", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+215:         return (greenlet._imap_task_index, IMapUnordered._iqueue_value_for_success(self, greenlet))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_greenlet, __pyx_n_s_imap_task_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_success(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self), __pyx_v_greenlet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 216: 
+217:     def _iqueue_value_for_failure(self, greenlet):
static PyObject *__pyx_f_6gevent_6__imap_4IMap__iqueue_value_for_failure(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self, PyObject *__pyx_v_greenlet) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_failure", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMap._iqueue_value_for_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+218:         return (greenlet._imap_task_index, IMapUnordered._iqueue_value_for_failure(self, greenlet))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_greenlet, __pyx_n_s_imap_task_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_failure(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self), __pyx_v_greenlet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 219: 
+220:     def _iqueue_value_for_self_finished(self):
static PyObject *__pyx_f_6gevent_6__imap_4IMap__iqueue_value_for_self_finished(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_self_finished", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMap._iqueue_value_for_self_finished", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+221:         return (self._max_index + 1, IMapUnordered._iqueue_value_for_self_finished(self))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->__pyx_base._max_index + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_self_finished(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 222: 
+223:     def _iqueue_value_for_self_failure(self, exception):
static PyObject *__pyx_f_6gevent_6__imap_4IMap__iqueue_value_for_self_failure(struct __pyx_obj_6gevent_6__imap_IMap *__pyx_v_self, PyObject *__pyx_v_exception) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_iqueue_value_for_self_failure", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("gevent.__imap.IMap._iqueue_value_for_self_failure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+224:         return (self._max_index + 1, IMapUnordered._iqueue_value_for_self_failure(self, exception))
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_self->__pyx_base._max_index + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_6gevent_6__imap_13IMapUnordered__iqueue_value_for_self_failure(((struct __pyx_obj_6gevent_6__imap_IMapUnordered *)__pyx_v_self), __pyx_v_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 225: 
+226: from gevent._util import import_c_accel
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_import_c_accel);
  __Pyx_GIVEREF(__pyx_n_s_import_c_accel);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_import_c_accel);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 226, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+227: import_c_accel(globals(), 'gevent.__imap')
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_gevent___imap);
  __Pyx_GIVEREF(__pyx_n_s_gevent___imap);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_gevent___imap);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;