Generated by Cython 3.1.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: _hub_primitives.c

    +001: # -*- coding: utf-8 -*-

      __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     002: # copyright (c) 2018 gevent. See  LICENSE.

     003: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False,binding=True

     004: """

     005: A collection of primitives used by the hub, and suitable for

     006: compilation with Cython because of their frequency of use.

     007:

     008:

     009: """

     010: from __future__ import absolute_import

     011: from __future__ import division

     012: from __future__ import print_function

     013:

    +014: import traceback

      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_traceback, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives_traceback);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives_traceback, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

     015:

    +016: from gevent.exceptions import InvalidSwitchError

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_exceptions, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives_InvalidSwitchError);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives_InvalidSwitchError, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +017: from gevent.exceptions import ConcurrentObjectUseError

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_ConcurrentObjectUseError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_exceptions, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ConcurrentObjectUseError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ConcurrentObjectUseError, __pyx_t_3) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     018:

    +019: from gevent import _greenlet_primitives

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_greenlet_primitives); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_greenlet_primitives); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives__greenlet_primitives);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives__greenlet_primitives, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +020: from gevent import _waiter

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_waiter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_waiter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives__waiter);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives__waiter, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +021: from gevent._util import _NONE

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NONE, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +022: from gevent._hub_local import get_hub_noargs as get_hub

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_get_hub_noargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__hub_local, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_hub_noargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_hub_noargs, __pyx_t_3) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +023: from gevent.timeout import Timeout

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_timeout, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives_Timeout);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives_Timeout, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     024:

     025: # In Cython, we define these as 'cdef inline' functions. The

     026: # compilation unit cannot have a direct assignment to them (import

     027: # is assignment) without generating a 'lvalue is not valid target'

     028: # error.

    +029: locals()['getcurrent'] = __import__('greenlet').getcurrent

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin___import__);
      __pyx_t_4 = __pyx_builtin___import__;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_greenlet};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getcurrent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_getcurrent, __pyx_t_4) < 0))) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +030: locals()['greenlet_init'] = lambda: None

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_18lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_18lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_24_gevent_c_hub_primitives_18lambda, METH_NOARGS, 0};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_18lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_lambda_funcdef_6gevent_24_gevent_c_hub_primitives_lambda(__pyx_self);

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

    static PyObject *__pyx_lambda_funcdef_6gevent_24_gevent_c_hub_primitives_lambda(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* function exit code */
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_18lambda, 0, __pyx_mstate_global->__pyx_n_u_lambda, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_greenlet_init, __pyx_t_4) < 0))) __PYX_ERR(0, 30, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +031: locals()['Waiter'] = _waiter.Waiter

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_24_gevent_c_hub_primitives__waiter, __pyx_mstate_global->__pyx_n_u_Waiter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Waiter, __pyx_t_4) < 0))) __PYX_ERR(0, 31, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +032: locals()['MultipleWaiter'] = _waiter.MultipleWaiter

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_24_gevent_c_hub_primitives__waiter, __pyx_mstate_global->__pyx_n_u_MultipleWaiter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_MultipleWaiter, __pyx_t_4) < 0))) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +033: locals()['SwitchOutGreenletWithLoop'] = _greenlet_primitives.SwitchOutGreenletWithLoop

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_24_gevent_c_hub_primitives__greenlet_primitives, __pyx_mstate_global->__pyx_n_u_SwitchOutGreenletWithLoop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely((PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_SwitchOutGreenletWithLoop, __pyx_t_4) < 0))) __PYX_ERR(0, 33, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     034:

    +035: __all__ = [

      __pyx_t_4 = __Pyx_PyList_Pack(6, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_iwait_on_objects, __pyx_mstate_global->__pyx_n_u_wait_on_objects, __pyx_mstate_global->__pyx_n_u_wait_read, __pyx_mstate_global->__pyx_n_u_wait_write, __pyx_mstate_global->__pyx_n_u_wait_readwrite); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_4) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     036:     'WaitOperationsGreenlet',

     037:     'iwait_on_objects',

     038:     'wait_on_objects',

     039:     'wait_read',

     040:     'wait_write',

     041:     'wait_readwrite',

     042: ]

     043:

    +044: class WaitOperationsGreenlet(SwitchOutGreenletWithLoop): # pylint:disable=undefined-variable

    struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet {
      struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop __pyx_base;
      PyObject *(*wait)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *, PyObject *, int __pyx_skip_dispatch);
      PyObject *(*cancel_wait)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_cancel_wait *__pyx_optional_args);
      PyObject *(*_cancel_wait)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
    };
    static struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_vtabptr_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet;

     045:

    +046:     def wait(self, watcher):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait(PyObject *__pyx_v_self, PyObject *__pyx_v_watcher); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher, int __pyx_skip_dispatch) {
      struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *__pyx_v_waiter = NULL;
      PyObject *__pyx_v_result = NULL;
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_wait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_watcher};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __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 && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #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_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_waiter);
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait(PyObject *__pyx_v_self, PyObject *__pyx_v_watcher); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait, "WaitOperationsGreenlet.wait(self, watcher)\n\nWait until the *watcher* (which must not be started) is ready.\n\nThe current greenlet will be unscheduled during this time.");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait = {"wait", (PyCFunction)__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait, METH_O, __pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait(PyObject *__pyx_v_self, PyObject *__pyx_v_watcher) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self), ((PyObject *)__pyx_v_watcher));

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_wait(__pyx_v_self, __pyx_v_watcher, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __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._gevent_c_hub_primitives.WaitOperationsGreenlet.wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_1wait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet_wait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_wait, __pyx_t_4) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     047:         """

     048:         Wait until the *watcher* (which must not be started) is ready.

     049:

     050:         The current greenlet will be unscheduled during this time.

     051:         """

    +052:         waiter = Waiter(self) # pylint:disable=undefined-variable

      __pyx_t_2 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter);
      __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_1);
      }
      __pyx_v_waiter = ((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_t_1);
      __pyx_t_1 = 0;

    +053:         watcher.start(waiter.switch, waiter)

      __pyx_t_4 = __pyx_v_watcher;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_waiter), __pyx_mstate_global->__pyx_n_u_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_v_waiter)};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +054:         try:

      /*try:*/ {

    +055:             result = waiter.get()

        __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_result = __pyx_t_1;
        __pyx_t_1 = 0;

    +056:             if result is not waiter:

        __pyx_t_6 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter));
        if (unlikely(__pyx_t_6)) {
    /* … */
        }
      }

    +057:                 raise InvalidSwitchError(

          __pyx_t_2 = NULL;
          __Pyx_INCREF(__pyx_v_6gevent_24_gevent_c_hub_primitives_InvalidSwitchError);
          __pyx_t_4 = __pyx_v_6gevent_24_gevent_c_hub_primitives_InvalidSwitchError;

    +058:                     'Invalid switch into %s: got %r (expected %r; waiting on %r with %r)' % (

          __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 11, 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 6 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 11 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
          if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 58, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_5 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_4))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
            assert(__pyx_t_2);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
            __pyx_t_5 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_12};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_Raise(__pyx_t_1, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(0, 57, __pyx_L4_error)

    +059:                         getcurrent(), # pylint:disable=undefined-variable

          __pyx_t_3 = ((PyObject *)__pyx_f_6gevent_24_gevent_c_hub_primitives_getcurrent()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +060:                         result,

          __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_result), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_3);

    +061:                         waiter,

          __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)__pyx_v_waiter)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 61, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_8);

    +062:                         self,

          __pyx_t_9 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)__pyx_v_self)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);

    +063:                         watcher

          __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_watcher), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 63, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_switch_into;
          __pyx_t_11[1] = __pyx_t_7;
          __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u_got;
          __pyx_t_11[3] = __pyx_t_3;
          __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u_expected;
          __pyx_t_11[5] = __pyx_t_8;
          __pyx_t_11[6] = __pyx_mstate_global->__pyx_kp_u_waiting_on;
          __pyx_t_11[7] = __pyx_t_9;
          __pyx_t_11[8] = __pyx_mstate_global->__pyx_kp_u_with;
          __pyx_t_11[9] = __pyx_t_10;
          __pyx_t_11[10] = __pyx_mstate_global->__pyx_kp_u_;

     064:                     )

     065:                 )

     066:         finally:

    +067:             watcher.stop()

      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_4 = __pyx_v_watcher;
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_5 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_stop, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L5;
        }
        __pyx_L4_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
          if ( unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_16);
          __Pyx_XGOTREF(__pyx_t_17);
          __Pyx_XGOTREF(__pyx_t_18);
          __Pyx_XGOTREF(__pyx_t_19);
          __Pyx_XGOTREF(__pyx_t_20);
          __Pyx_XGOTREF(__pyx_t_21);
          __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
          {
            __pyx_t_4 = __pyx_v_watcher;
            __Pyx_INCREF(__pyx_t_4);
            __pyx_t_5 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_stop, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L8_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
          __Pyx_XGIVEREF(__pyx_t_16);
          __Pyx_XGIVEREF(__pyx_t_17);
          __Pyx_XGIVEREF(__pyx_t_18);
          __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
          __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
          goto __pyx_L1_error;
          __pyx_L8_error:;
          __Pyx_XGIVEREF(__pyx_t_19);
          __Pyx_XGIVEREF(__pyx_t_20);
          __Pyx_XGIVEREF(__pyx_t_21);
          __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21);
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L5:;
      }

     068:

    +069:     def cancel_waits_close_and_then(self, watchers, exc_kind, then, *then_args):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_3cancel_waits_close_and_then(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_2cancel_waits_close_and_then, "WaitOperationsGreenlet.cancel_waits_close_and_then(self, watchers, exc_kind, then, *then_args)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_3cancel_waits_close_and_then = {"cancel_waits_close_and_then", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_3cancel_waits_close_and_then, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_2cancel_waits_close_and_then};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_3cancel_waits_close_and_then(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_watchers = 0;
      PyObject *__pyx_v_exc_kind = 0;
      PyObject *__pyx_v_then = 0;
      PyObject *__pyx_v_then_args = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cancel_waits_close_and_then (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      __pyx_v_then_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 3, __pyx_nargs);
      if (unlikely(!__pyx_v_then_args)) {
        __Pyx_RefNannyFinishContext();
        return NULL;
      }
      __Pyx_GOTREF(__pyx_v_then_args);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_watchers,&__pyx_mstate_global->__pyx_n_u_exc_kind,&__pyx_mstate_global->__pyx_n_u_then,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 69, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            default:
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 69, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 69, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 69, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          const Py_ssize_t used_pos_args = (kwd_pos_args < 3) ? kwd_pos_args : 3;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, used_pos_args, __pyx_kwds_len, "cancel_waits_close_and_then", 0) < 0) __PYX_ERR(0, 69, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cancel_waits_close_and_then", 0, 3, 3, i); __PYX_ERR(0, 69, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs < 3)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 69, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 69, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 69, __pyx_L3_error)
        }
        __pyx_v_watchers = values[0];
        __pyx_v_exc_kind = values[1];
        __pyx_v_then = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("cancel_waits_close_and_then", 0, 3, 3, __pyx_nargs); __PYX_ERR(0, 69, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_DECREF(__pyx_v_then_args); __pyx_v_then_args = 0;
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.cancel_waits_close_and_then", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_2cancel_waits_close_and_then(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self), __pyx_v_watchers, __pyx_v_exc_kind, __pyx_v_then, __pyx_v_then_args);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_DECREF(__pyx_v_then_args);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_2cancel_waits_close_and_then(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watchers, PyObject *__pyx_v_exc_kind, PyObject *__pyx_v_then, PyObject *__pyx_v_then_args) {
      PyObject *__pyx_v_deferred = NULL;
      PyObject *__pyx_v_watcher = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* 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_4);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.cancel_waits_close_and_then", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_deferred);
      __Pyx_XDECREF(__pyx_v_watcher);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_3cancel_waits_close_and_then, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet_cancel_wa, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_cancel_waits_close_and_then, __pyx_t_4) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +070:         deferred = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_deferred = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +071:         for watcher in watchers:

      if (likely(PyList_CheckExact(__pyx_v_watchers)) || PyTuple_CheckExact(__pyx_v_watchers)) {
        __pyx_t_1 = __pyx_v_watchers; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_3 = NULL;
      } else {
        __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_watchers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_3)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
            ++__pyx_t_2;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 71, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
            #endif
            ++__pyx_t_2;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 71, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_watcher, __pyx_t_4);
        __pyx_t_4 = 0;
    /* … */
        __pyx_L3_continue:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +072:             if watcher is None:

        __pyx_t_5 = (__pyx_v_watcher == Py_None);
        if (__pyx_t_5) {
    /* … */
        }

    +073:                 continue

          goto __pyx_L3_continue;

    +074:             if watcher.callback is None:

        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_callback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = (__pyx_t_4 == Py_None);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_5) {
    /* … */
          goto __pyx_L6;
        }

    +075:                 watcher.close()

          __pyx_t_6 = __pyx_v_watcher;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_7 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
            __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     076:             else:

    +077:                 deferred.append(watcher)

        /*else*/ {
          __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_deferred, __pyx_v_watcher); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 77, __pyx_L1_error)
        }
        __pyx_L6:;

    +078:         if deferred:

      __pyx_t_5 = (__Pyx_PyList_GET_SIZE(__pyx_v_deferred) != 0);
      if (unlikely(((!CYTHON_ASSUME_SAFE_MACROS) && __pyx_t_5 < 0))) __PYX_ERR(0, 78, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
        goto __pyx_L8;
      }

    +079:             self.loop.run_callback(self._cancel_waits_then, deferred, exc_kind, then, then_args)

        __pyx_t_4 = __pyx_v_self->__pyx_base.loop;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_cancel_waits_then); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = 0;
        {
          PyObject *__pyx_callargs[6] = {__pyx_t_4, __pyx_t_6, __pyx_v_deferred, __pyx_v_exc_kind, __pyx_v_then, __pyx_v_then_args};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_7, (6-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     080:         else:

    +081:             then(*then_args)

      /*else*/ {
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_then, __pyx_v_then_args, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L8:;

     082:

    +083:     def _cancel_waits_then(self, watchers, exc_kind, then, then_args):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_5_cancel_waits_then(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_4_cancel_waits_then, "WaitOperationsGreenlet._cancel_waits_then(self, watchers, exc_kind, then, then_args)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_5_cancel_waits_then = {"_cancel_waits_then", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_5_cancel_waits_then, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_4_cancel_waits_then};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_5_cancel_waits_then(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_watchers = 0;
      PyObject *__pyx_v_exc_kind = 0;
      PyObject *__pyx_v_then = 0;
      PyObject *__pyx_v_then_args = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_cancel_waits_then (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_watchers,&__pyx_mstate_global->__pyx_n_u_exc_kind,&__pyx_mstate_global->__pyx_n_u_then,&__pyx_mstate_global->__pyx_n_u_then_args,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 83, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 83, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 83, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 83, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 83, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_cancel_waits_then", 0) < 0) __PYX_ERR(0, 83, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_cancel_waits_then", 1, 4, 4, i); __PYX_ERR(0, 83, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 4)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 83, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 83, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 83, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 83, __pyx_L3_error)
        }
        __pyx_v_watchers = values[0];
        __pyx_v_exc_kind = values[1];
        __pyx_v_then = values[2];
        __pyx_v_then_args = values[3];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_cancel_waits_then", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 83, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet._cancel_waits_then", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_4_cancel_waits_then(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self), __pyx_v_watchers, __pyx_v_exc_kind, __pyx_v_then, __pyx_v_then_args);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_4_cancel_waits_then(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watchers, PyObject *__pyx_v_exc_kind, PyObject *__pyx_v_then, PyObject *__pyx_v_then_args) {
      PyObject *__pyx_v_watcher = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* 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_4);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet._cancel_waits_then", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_watcher);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_5_cancel_waits_then, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet__cancel_w, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_cancel_waits_then, __pyx_t_4) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +084:         for watcher in watchers:

      if (likely(PyList_CheckExact(__pyx_v_watchers)) || PyTuple_CheckExact(__pyx_v_watchers)) {
        __pyx_t_1 = __pyx_v_watchers; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_3 = NULL;
      } else {
        __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_watchers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_3)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
            ++__pyx_t_2;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 84, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
            #endif
            ++__pyx_t_2;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 84, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_watcher, __pyx_t_4);
        __pyx_t_4 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +085:             self._cancel_wait(watcher, exc_kind, True)

        __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self->__pyx_base.__pyx_vtab)->_cancel_wait(__pyx_v_self, __pyx_v_watcher, __pyx_v_exc_kind, Py_True, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +086:         then(*then_args)

      __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_then_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_then, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     087:

    +088:     def cancel_wait(self, watcher, error, close_watcher=False):

    /* "src/gevent/_hub_primitives.py":88
     *         then(*then_args)
     *
     *     def cancel_wait(self, watcher, error, close_watcher=False):             # <<<<<<<<<<<<<<
     *         """
     *         Cancel an in-progress call to :meth:`wait` by throwing the given *error*
    */

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_cancel_wait(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher, PyObject *__pyx_v_error, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_cancel_wait *__pyx_optional_args) {
      PyObject *__pyx_v_close_watcher = ((PyObject *)Py_False);
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_close_watcher = __pyx_optional_args->close_watcher;
        }
      }
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_cancel_wait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __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 && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }

      /* "src/gevent/_hub_primitives.py":88
     *         then(*then_args)
     *
     *     def cancel_wait(self, watcher, error, close_watcher=False):             # <<<<<<<<<<<<<<
     *         """
     *         Cancel an in-progress call to :meth:`wait` by throwing the given *error*
    */

      /* 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._gevent_c_hub_primitives.WaitOperationsGreenlet.cancel_wait", __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_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_6cancel_wait, "WaitOperationsGreenlet.cancel_wait(self, watcher, error, close_watcher=False)\n\nCancel an in-progress call to :meth:`wait` by throwing the given *error*\nin the waiting greenlet.\n\n.. versionchanged:: 1.3a1\n   Added the *close_watcher* parameter. If true, the watcher\n   will be closed after the exception is thrown. The watcher should then\n   be discarded. Closing the watcher is important to release native resources.\n.. versionchanged:: 1.3a2\n   Allow the *watcher* to be ``None``. No action is taken in that case.");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait = {"cancel_wait", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_6cancel_wait};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_watcher = 0;
      PyObject *__pyx_v_error = 0;
      PyObject *__pyx_v_close_watcher = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cancel_wait (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_watcher,&__pyx_mstate_global->__pyx_n_u_error,&__pyx_mstate_global->__pyx_n_u_close_watcher,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 88, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 88, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 88, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 88, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "cancel_wait", 0) < 0) __PYX_ERR(0, 88, __pyx_L3_error)
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cancel_wait", 0, 2, 3, i); __PYX_ERR(0, 88, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 88, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 88, __pyx_L3_error)
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 88, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_False));
        }
        __pyx_v_watcher = values[0];
        __pyx_v_error = values[1];
        __pyx_v_close_watcher = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("cancel_wait", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 88, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.cancel_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_6cancel_wait(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self), __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_6cancel_wait(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher, PyObject *__pyx_v_error, PyObject *__pyx_v_close_watcher) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.close_watcher = __pyx_v_close_watcher;
      __pyx_t_1 = __pyx_vtabptr_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet->cancel_wait(__pyx_v_self, __pyx_v_watcher, __pyx_v_error, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __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._gevent_c_hub_primitives.WaitOperationsGreenlet.cancel_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

      /* "src/gevent/_hub_primitives.py":88
     *         then(*then_args)
     *
     *     def cancel_wait(self, watcher, error, close_watcher=False):             # <<<<<<<<<<<<<<
     *         """
     *         Cancel an in-progress call to :meth:`wait` by throwing the given *error*
    */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_7cancel_wait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet_cancel_wa_2, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[1]);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_cancel_wait, __pyx_t_4) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "src/gevent/_hub_primitives.py":88
     *         then(*then_args)
     *
     *     def cancel_wait(self, watcher, error, close_watcher=False):             # <<<<<<<<<<<<<<
     *         """
     *         Cancel an in-progress call to :meth:`wait` by throwing the given *error*
    */
      __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);

     089:         """

     090:         Cancel an in-progress call to :meth:`wait` by throwing the given *error*

     091:         in the waiting greenlet.

     092:

     093:         .. versionchanged:: 1.3a1

     094:            Added the *close_watcher* parameter. If true, the watcher

     095:            will be closed after the exception is thrown. The watcher should then

     096:            be discarded. Closing the watcher is important to release native resources.

     097:         .. versionchanged:: 1.3a2

     098:            Allow the *watcher* to be ``None``. No action is taken in that case.

     099:

     100:         """

    +101:         if watcher is None:

      __pyx_t_6 = (__pyx_v_watcher == Py_None);
      if (__pyx_t_6) {
    /* … */
      }

     102:             # Presumably already closed.

     103:             # See https://github.com/gevent/gevent/issues/1089

    +104:             return

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

     105:

    +106:         if watcher.callback is not None:

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = (__pyx_t_1 != Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_6) {
    /* … */
      }

    +107:             self.loop.run_callback(self._cancel_wait, watcher, error, close_watcher)

        __pyx_t_2 = __pyx_v_self->__pyx_base.loop;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_cancel_wait_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_4, __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +108:             return

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

     109:

    +110:         if close_watcher:

      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_close_watcher); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L1_error)
      if (__pyx_t_6) {
    /* … */
      }

    +111:             watcher.close()

        __pyx_t_4 = __pyx_v_watcher;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     112:

    +113:     def _cancel_wait(self, watcher, error, close_watcher):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet__cancel_wait(CYTHON_UNUSED struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher, PyObject *__pyx_v_error, PyObject *__pyx_v_close_watcher, int __pyx_skip_dispatch) {
      PyObject *__pyx_v_active = NULL;
      PyObject *__pyx_v_cb = NULL;
      PyObject *__pyx_v_glet = NULL;
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_cancel_wait_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __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 && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #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._gevent_c_hub_primitives.WaitOperationsGreenlet._cancel_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_active);
      __Pyx_XDECREF(__pyx_v_cb);
      __Pyx_XDECREF(__pyx_v_glet);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_8_cancel_wait, "WaitOperationsGreenlet._cancel_wait(self, watcher, error, close_watcher)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait = {"_cancel_wait", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_8_cancel_wait};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_watcher = 0;
      PyObject *__pyx_v_error = 0;
      PyObject *__pyx_v_close_watcher = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_cancel_wait (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_watcher,&__pyx_mstate_global->__pyx_n_u_error,&__pyx_mstate_global->__pyx_n_u_close_watcher,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 113, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 113, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 113, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 113, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_cancel_wait", 0) < 0) __PYX_ERR(0, 113, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_cancel_wait", 1, 3, 3, i); __PYX_ERR(0, 113, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 113, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 113, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 113, __pyx_L3_error)
        }
        __pyx_v_watcher = values[0];
        __pyx_v_error = values[1];
        __pyx_v_close_watcher = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_cancel_wait", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 113, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet._cancel_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_8_cancel_wait(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_self), __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_8_cancel_wait(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_self, PyObject *__pyx_v_watcher, PyObject *__pyx_v_error, PyObject *__pyx_v_close_watcher) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet__cancel_wait(__pyx_v_self, __pyx_v_watcher, __pyx_v_error, __pyx_v_close_watcher, 1); 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;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.WaitOperationsGreenlet._cancel_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_22WaitOperationsGreenlet_9_cancel_wait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitOperationsGreenlet__cancel_w_2, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, __pyx_mstate_global->__pyx_n_u_cancel_wait_2, __pyx_t_4) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     114:         # Running in the hub. Switches to the waiting greenlet to raise

     115:         # the error; assuming the waiting greenlet dies, switches back

     116:         # to this  (because the waiting greenlet's parent is the hub.)

     117:

     118:         # We have to check again to see if it was still active by the time

     119:         # our callback actually runs.

    +120:         active = watcher.active

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_active); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_active = __pyx_t_1;
      __pyx_t_1 = 0;

    +121:         cb = watcher.callback

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_cb = __pyx_t_1;
      __pyx_t_1 = 0;

    +122:         if close_watcher:

      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_close_watcher); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 122, __pyx_L1_error)
      if (__pyx_t_6) {
    /* … */
      }

    +123:             watcher.close()

        __pyx_t_2 = __pyx_v_watcher;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +124:         if active:

      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_active); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 124, __pyx_L1_error)
      if (__pyx_t_6) {
    /* … */
      }

     125:             # The callback should be greenlet.switch(). It may or may not be None.

    +126:             glet = getattr(cb, '__self__', None)

        __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_cb, __pyx_mstate_global->__pyx_n_u_self, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_glet = __pyx_t_1;
        __pyx_t_1 = 0;

    +127:             if glet is not None:

        __pyx_t_6 = (__pyx_v_glet != Py_None);
        if (__pyx_t_6) {
    /* … */
        }

    +128:                 glet.throw(error)

          __pyx_t_2 = __pyx_v_glet;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_5 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_error};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_throw, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     129:

     130:

    +131: class _WaitIterator(object):

    struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator {
      PyObject *(*_begin)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *);
      PyObject *(*_cleanup)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *);
      PyObject *(*__pyx___enter__)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *, int __pyx_skip_dispatch);
      PyObject *(*__pyx___exit__)(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch);
    };
    static struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_vtabptr_6gevent_24_gevent_c_hub_primitives__WaitIterator;

     132:

    +133:     def __init__(self, objects, hub, timeout, count):

    /* Python wrapper */
    static int __pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_objects = 0;
      PyObject *__pyx_v_hub = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_count = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_objects,&__pyx_mstate_global->__pyx_n_u_hub,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_count,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 133, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 133, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 133, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 133, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 133, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 133, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, i); __PYX_ERR(0, 133, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 4)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 133, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 133, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 133, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 133, __pyx_L3_error)
        }
        __pyx_v_objects = values[0];
        __pyx_v_hub = values[1];
        __pyx_v_timeout = values[2];
        __pyx_v_count = values[3];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 133, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___init__(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self), __pyx_v_objects, __pyx_v_hub, __pyx_v_timeout, __pyx_v_count);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___init__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self, PyObject *__pyx_v_objects, PyObject *__pyx_v_hub, PyObject *__pyx_v_timeout, PyObject *__pyx_v_count) {
      int __pyx_r;
    /* … */
      /* 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_XDECREF(__pyx_t_8);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +134:         self._hub = hub

      __pyx_t_1 = __pyx_v_hub;
      __Pyx_INCREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop))))) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_hub);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_hub);
      __pyx_v_self->_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +135:         self._waiter = MultipleWaiter(hub) # pylint:disable=undefined-variable

      __pyx_t_2 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_MultipleWaiter);
      __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_MultipleWaiter);
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_hub};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_1);
      }
      __Pyx_GIVEREF((PyObject *)__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_waiter);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_waiter);
      __pyx_v_self->_waiter = ((struct __pyx_obj_6gevent_16_gevent_c_waiter_MultipleWaiter *)__pyx_t_1);
      __pyx_t_1 = 0;

    +136:         self._switch = self._waiter.switch

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_waiter), __pyx_mstate_global->__pyx_n_u_switch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_switch);
      __Pyx_DECREF(__pyx_v_self->_switch);
      __pyx_v_self->_switch = __pyx_t_1;
      __pyx_t_1 = 0;

    +137:         self._timeout = timeout

      __Pyx_INCREF(__pyx_v_timeout);
      __Pyx_GIVEREF(__pyx_v_timeout);
      __Pyx_GOTREF(__pyx_v_self->_timeout);
      __Pyx_DECREF(__pyx_v_self->_timeout);
      __pyx_v_self->_timeout = __pyx_v_timeout;

    +138:         self._objects = objects

      __Pyx_INCREF(__pyx_v_objects);
      __Pyx_GIVEREF(__pyx_v_objects);
      __Pyx_GOTREF(__pyx_v_self->_objects);
      __Pyx_DECREF(__pyx_v_self->_objects);
      __pyx_v_self->_objects = __pyx_v_objects;

     139:

    +140:         self._timer = None

      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_timer);
      __Pyx_DECREF(__pyx_v_self->_timer);
      __pyx_v_self->_timer = Py_None;

    +141:         self._begun = False

      __pyx_v_self->_begun = 0;

     142:

     143:         # Even if we're only going to return 1 object,

     144:         # we must still rawlink() *all* of them, so that no

     145:         # matter which one finishes first we find it.

    +146:         self._count = len(objects) if count is None else min(count, len(objects))

      __pyx_t_6 = (__pyx_v_count == Py_None);
      if (__pyx_t_6) {
        __pyx_t_7 = PyObject_Length(__pyx_v_objects); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 146, __pyx_L1_error)
        __pyx_t_5 = __pyx_t_7;
      } else {
        __pyx_t_7 = PyObject_Length(__pyx_v_objects); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_INCREF(__pyx_v_count);
        __pyx_t_1 = __pyx_v_count;
        __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_9) {
          __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_3 = __pyx_t_8;
          __pyx_t_8 = 0;
        } else {
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_3 = __pyx_t_1;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __pyx_t_7;
      }
      __pyx_v_self->_count = __pyx_t_5;

     147:

    +148:     def _begin(self):

    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator__begin(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self) {
      PyObject *__pyx_v_obj = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* 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_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator._begin", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_obj);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +149:         if self._begun:

      if (__pyx_v_self->_begun) {
    /* … */
      }

    +150:             return

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

     151:

    +152:         self._begun = True

      __pyx_v_self->_begun = 1;

     153:

     154:         # XXX: If iteration doesn't actually happen, we

     155:         # could leave these links around!

    +156:         for obj in self._objects:

      if (likely(PyList_CheckExact(__pyx_v_self->_objects)) || PyTuple_CheckExact(__pyx_v_self->_objects)) {
        __pyx_t_1 = __pyx_v_self->_objects; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_3 = NULL;
      } else {
        __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_3)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 156, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
            ++__pyx_t_2;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 156, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
            #endif
            ++__pyx_t_2;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error)
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 156, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_4);
        __pyx_t_4 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +157:             obj.rawlink(self._switch)

        __pyx_t_5 = __pyx_v_obj;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_self->_switch};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_rawlink, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     158:

    +159:         if self._timeout is not None:

      __pyx_t_7 = (__pyx_v_self->_timeout != Py_None);
      if (__pyx_t_7) {
    /* … */
      }

    +160:             self._timer = self._hub.loop.timer(self._timeout, priority=-1)

        __pyx_t_4 = __pyx_v_self->_hub->loop;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_self->_timeout};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_priority, __pyx_mstate_global->__pyx_int_neg_1, __pyx_t_5, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_timer, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_v_self->_timer);
        __Pyx_DECREF(__pyx_v_self->_timer);
        __pyx_v_self->_timer = __pyx_t_1;
        __pyx_t_1 = 0;

    +161:             self._timer.start(self._switch, self)

        __pyx_t_5 = __pyx_v_self->_timer;
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_self->_switch, ((PyObject *)__pyx_v_self)};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     162:

    +163:     def __iter__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_3__iter__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_2__iter__(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_2__iter__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +164:         return self

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __pyx_r = ((PyObject *)__pyx_v_self);
      goto __pyx_L0;

     165:

    +166:     def __next__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_5__next__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_5__next__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_4__next__(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_4__next__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self) {
      PyObject *__pyx_v_item = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_9);
      if (!__pyx_error_without_exception) {
        __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      }
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_item);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +167:         self._begin()

      __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self->__pyx_vtab)->_begin(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     168:

    +169:         if self._count == 0:

      __pyx_t_2 = (__pyx_v_self->_count == 0);
      if (unlikely(__pyx_t_2)) {
    /* … */
      }

     170:             # Exhausted

    +171:             self._cleanup()

        __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self->__pyx_vtab)->_cleanup(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +172:             raise StopIteration()

        __pyx_error_without_exception = 1;
        goto __pyx_L1_error;;

     173:

    +174:         self._count -= 1

      __pyx_v_self->_count = (__pyx_v_self->_count - 1);

    +175:         try:

      {
        /*try:*/ {
    /* … */
        }
        __pyx_L4_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
        __pyx_L6_except_error:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        goto __pyx_L1_error;
        __pyx_L8_try_return:;
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        goto __pyx_L0;
      }

    +176:             item = self._waiter.get()

          __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_MultipleWaiter *)__pyx_v_self->_waiter->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_self->_waiter), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_item = __pyx_t_1;
          __pyx_t_1 = 0;

    +177:             self._waiter.clear()

          __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_MultipleWaiter *)__pyx_v_self->_waiter->__pyx_base.__pyx_vtab)->__pyx_base.clear(((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_self->_waiter), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +178:             if item is self:

          __pyx_t_2 = (__pyx_v_item == ((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_t_2)) {
    /* … */
          }

     179:                 # Timer expired, no more

    +180:                 self._cleanup()

            __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self->__pyx_vtab)->_cleanup(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +181:                 raise StopIteration()

            __pyx_t_6 = NULL;
            __Pyx_INCREF(__pyx_builtin_StopIteration);
            __pyx_t_7 = __pyx_builtin_StopIteration;
            __pyx_t_8 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
              __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L4_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_Raise(__pyx_t_1, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __PYX_ERR(0, 181, __pyx_L4_error)

    +182:             return item

          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_item);
          __pyx_r = __pyx_v_item;
          goto __pyx_L8_try_return;

    +183:         except:

        /*except:*/ {
          __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(0, 183, __pyx_L6_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_6);

    +184:             self._cleanup()

          __pyx_t_9 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self->__pyx_vtab)->_cleanup(__pyx_v_self); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 184, __pyx_L6_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    +185:             raise

          __Pyx_GIVEREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_7, __pyx_t_6);
          __pyx_t_1 = 0;  __pyx_t_7 = 0;  __pyx_t_6 = 0;
          __PYX_ERR(0, 185, __pyx_L6_except_error)
        }

     186:

    +187:     next = __next__

      __Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator, __pyx_mstate_global->__pyx_n_u_next_2, __pyx_t_4) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     188:

    +189:     def _cleanup(self):

    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator__cleanup(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self) {
      PyObject *__pyx_v_objs = NULL;
      PyObject *__pyx_v_aobj = NULL;
      PyObject *__pyx_v_unlink = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* 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_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator._cleanup", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_objs);
      __Pyx_XDECREF(__pyx_v_aobj);
      __Pyx_XDECREF(__pyx_v_unlink);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +190:         if self._timer is not None:

      __pyx_t_1 = (__pyx_v_self->_timer != Py_None);
      if (__pyx_t_1) {
    /* … */
      }

    +191:             self._timer.close()

        __pyx_t_3 = __pyx_v_self->_timer;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +192:             self._timer = None

        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_timer);
        __Pyx_DECREF(__pyx_v_self->_timer);
        __pyx_v_self->_timer = Py_None;

     193:

    +194:         objs = self._objects

      __pyx_t_2 = __pyx_v_self->_objects;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_objs = __pyx_t_2;
      __pyx_t_2 = 0;

    +195:         self._objects = ()

      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_empty_tuple);
      __Pyx_GOTREF(__pyx_v_self->_objects);
      __Pyx_DECREF(__pyx_v_self->_objects);
      __pyx_v_self->_objects = __pyx_mstate_global->__pyx_empty_tuple;

    +196:         for aobj in objs:

      if (likely(PyList_CheckExact(__pyx_v_objs)) || PyTuple_CheckExact(__pyx_v_objs)) {
        __pyx_t_2 = __pyx_v_objs; __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_objs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 196, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_5);
            ++__pyx_t_5;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 196, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5));
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5);
            #endif
            ++__pyx_t_5;
          }
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
        } else {
          __pyx_t_3 = __pyx_t_6(__pyx_t_2);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 196, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_aobj, __pyx_t_3);
        __pyx_t_3 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +197:             unlink = getattr(aobj, 'unlink', None)

        __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_aobj, __pyx_mstate_global->__pyx_n_u_unlink, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF_SET(__pyx_v_unlink, __pyx_t_3);
        __pyx_t_3 = 0;

    +198:             if unlink is not None:

        __pyx_t_1 = (__pyx_v_unlink != Py_None);
        if (__pyx_t_1) {
    /* … */
        }

    +199:                 try:

          {
            /*try:*/ {
    /* … */
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            goto __pyx_L14_try_end;
            __pyx_L7_error:;
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    /* … */
            __pyx_L9_except_error:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            goto __pyx_L1_error;
            __pyx_L8_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_7);
            __Pyx_XGIVEREF(__pyx_t_8);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
            __pyx_L14_try_end:;
          }

    +200:                     unlink(self._switch)

              __pyx_t_10 = NULL;
              __Pyx_INCREF(__pyx_v_unlink);
              __pyx_t_11 = __pyx_v_unlink;
              __pyx_t_4 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_11))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
                assert(__pyx_t_10);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_10);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
                __pyx_t_4 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_self->_switch};
                __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
                __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
                if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L7_error)
                __Pyx_GOTREF(__pyx_t_3);
              }
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +201:                 except: # pylint:disable=bare-except

            /*except:*/ {
              __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator._cleanup", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_11, &__pyx_t_10) < 0) __PYX_ERR(0, 201, __pyx_L9_except_error)
              __Pyx_XGOTREF(__pyx_t_3);
              __Pyx_XGOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_t_10);

    +202:                     traceback.print_exc()

              __pyx_t_13 = __pyx_v_6gevent_24_gevent_c_hub_primitives_traceback;
              __Pyx_INCREF(__pyx_t_13);
              __pyx_t_4 = 0;
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
                __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_print_exc, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 202, __pyx_L9_except_error)
                __Pyx_GOTREF(__pyx_t_12);
              }
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L8_exception_handled;
            }

     203:

    +204:     def __enter__(self):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___enter__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __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 && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __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._gevent_c_hub_primitives._WaitIterator.__enter__", __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_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_6__enter__, "_WaitIterator.__enter__(self)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__ = {"__enter__", (PyCFunction)__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__, METH_NOARGS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_6__enter__};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_6__enter__(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_6__enter__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___enter__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __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._gevent_c_hub_primitives._WaitIterator.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_7__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitIterator___enter, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator, __pyx_mstate_global->__pyx_n_u_enter, __pyx_t_4) < 0) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +205:         return self

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __pyx_r = ((PyObject *)__pyx_v_self);
      goto __pyx_L0;

     206:

    +207:     def __exit__(self, typ, value, tb):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___exit__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_typ, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_typ, __pyx_v_value, __pyx_v_tb};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __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 && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #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._gevent_c_hub_primitives._WaitIterator.__exit__", __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_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_8__exit__, "_WaitIterator.__exit__(self, typ, value, tb)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__ = {"__exit__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_8__exit__};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_typ = 0;
      PyObject *__pyx_v_value = 0;
      PyObject *__pyx_v_tb = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_typ,&__pyx_mstate_global->__pyx_n_u_value,&__pyx_mstate_global->__pyx_n_u_tb,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 207, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 207, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 207, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 207, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__exit__", 0) < 0) __PYX_ERR(0, 207, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, i); __PYX_ERR(0, 207, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 207, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 207, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 207, __pyx_L3_error)
        }
        __pyx_v_typ = values[0];
        __pyx_v_value = values[1];
        __pyx_v_tb = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 207, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._WaitIterator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_8__exit__(((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self), __pyx_v_typ, __pyx_v_value, __pyx_v_tb);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_8__exit__(struct __pyx_obj_6gevent_24_gevent_c_hub_primitives__WaitIterator *__pyx_v_self, PyObject *__pyx_v_typ, PyObject *__pyx_v_value, PyObject *__pyx_v_tb) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_13_WaitIterator___exit__(__pyx_v_self, __pyx_v_typ, __pyx_v_value, __pyx_v_tb, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __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._gevent_c_hub_primitives._WaitIterator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_13_WaitIterator_9__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_WaitIterator___exit, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator, __pyx_mstate_global->__pyx_n_u_exit, __pyx_t_4) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +208:         self._cleanup()

      __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives__WaitIterator *)__pyx_v_self->__pyx_vtab)->_cleanup(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     209:

     210:

    +211: def iwait_on_objects(objects, timeout=None, count=None):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_iwait_on_objects(PyObject *__pyx_v_objects, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_iwait_on_objects *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_count = ((PyObject *)Py_None);
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_count = __pyx_optional_args->count;
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.iwait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_iwait_on_objects, "iwait_on_objects(objects, timeout=None, count=None)\n\nIteratively yield *objects* as they are ready, until all (or *count*) are ready\nor *timeout* expired.\n\nIf you will only be consuming a portion of the *objects*, you should\ndo so inside a ``with`` block on this object to avoid leaking resources::\n\n    with gevent.iwait((a, b, c)) as it:\n        for i in it:\n            if i is a:\n                break\n\n:param objects: A sequence (supporting :func:`len`) containing objects\n    implementing the wait protocol (rawlink() and unlink()).\n:keyword int count: If not `None`, then a number specifying the maximum number\n    of objects to wait for. If ``None`` (the default), all objects\n    are waited for.\n:keyword float timeout: If given, specifies a maximum number of seconds\n    to wait. If the timeout expires before the desired waited-for objects\n    are available, then this method returns immediately.\n\n.. seealso:: :func:`wait`\n\n.. versionchanged:: 1.1a1\n   Add the *count* parameter.\n.. versionchanged:: 1.1a2\n   No longer raise :exc:`LoopExit` if our caller switches greenlets\n   in between items yielded by this function.\n.. versionchanged:: 1.4\n   Add support to use the returned object as a context manager.");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects = {"iwait_on_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_iwait_on_objects};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_objects = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_count = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("iwait_on_objects (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_objects,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_count,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 211, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 211, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 211, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "iwait_on_objects", 0) < 0) __PYX_ERR(0, 211, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("iwait_on_objects", 0, 1, 3, i); __PYX_ERR(0, 211, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 211, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 211, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 211, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
        }
        __pyx_v_objects = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_count = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("iwait_on_objects", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 211, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.iwait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_iwait_on_objects(__pyx_self, __pyx_v_objects, __pyx_v_timeout, __pyx_v_count);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_iwait_on_objects(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objects, PyObject *__pyx_v_timeout, PyObject *__pyx_v_count) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 2;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.count = __pyx_v_count;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_iwait_on_objects(__pyx_v_objects, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __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._gevent_c_hub_primitives.iwait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_1iwait_on_objects, 0, __pyx_mstate_global->__pyx_n_u_iwait_on_objects, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[2]);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iwait_on_objects, __pyx_t_4) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
      __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);

     212:     """

     213:     Iteratively yield *objects* as they are ready, until all (or *count*) are ready

     214:     or *timeout* expired.

     215:

     216:     If you will only be consuming a portion of the *objects*, you should

     217:     do so inside a ``with`` block on this object to avoid leaking resources::

     218:

     219:         with gevent.iwait((a, b, c)) as it:

     220:             for i in it:

     221:                 if i is a:

     222:                     break

     223:

     224:     :param objects: A sequence (supporting :func:`len`) containing objects

     225:         implementing the wait protocol (rawlink() and unlink()).

     226:     :keyword int count: If not `None`, then a number specifying the maximum number

     227:         of objects to wait for. If ``None`` (the default), all objects

     228:         are waited for.

     229:     :keyword float timeout: If given, specifies a maximum number of seconds

     230:         to wait. If the timeout expires before the desired waited-for objects

     231:         are available, then this method returns immediately.

     232:

     233:     .. seealso:: :func:`wait`

     234:

     235:     .. versionchanged:: 1.1a1

     236:        Add the *count* parameter.

     237:     .. versionchanged:: 1.1a2

     238:        No longer raise :exc:`LoopExit` if our caller switches greenlets

     239:        in between items yielded by this function.

     240:     .. versionchanged:: 1.4

     241:        Add support to use the returned object as a context manager.

     242:     """

     243:     # QQQ would be nice to support iterable here that can be generated slowly (why?)

    +244:     hub = get_hub()

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +245:     if objects is None:

      __pyx_t_2 = (__pyx_v_objects == Py_None);
      if (__pyx_t_2) {
    /* … */
      }

    +246:         return [hub.join(timeout=timeout)]

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = ((PyObject *)__pyx_v_hub);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_timeout, __pyx_v_timeout, __pyx_t_5, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 246, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_1);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 246, __pyx_L1_error);
        __pyx_t_1 = 0;
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L0;

    +247:     return _WaitIterator(objects, hub, timeout, count)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator);
      __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives__WaitIterator);
      __pyx_t_4 = 1;
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_1, __pyx_v_objects, ((PyObject *)__pyx_v_hub), __pyx_v_timeout, __pyx_v_count};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }
      __pyx_r = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;

     248:

     249:

    +250: def wait_on_objects(objects=None, timeout=None, count=None):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_3wait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_objects(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_on_objects *__pyx_optional_args) {
      PyObject *__pyx_v_objects = ((PyObject *)Py_None);
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_count = ((PyObject *)Py_None);
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_objects = __pyx_optional_args->objects;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_timeout = __pyx_optional_args->timeout;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_count = __pyx_optional_args->count;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_3wait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_2wait_on_objects, "wait_on_objects(objects=None, timeout=None, count=None)\n\nWait for *objects* to become ready or for event loop to finish.\n\nIf *objects* is provided, it must be a list containing objects\nimplementing the wait protocol (rawlink() and unlink() methods):\n\n- :class:`gevent.Greenlet` instance\n- :class:`gevent.event.Event` instance\n- :class:`gevent.lock.Semaphore` instance\n- :class:`gevent.subprocess.Popen` instance\n\nIf *objects* is ``None`` (the default), ``wait()`` blocks until\nthe current event loop has nothing to do (or until *timeout* passes):\n\n- all greenlets have finished\n- all servers were stopped\n- all event loop watchers were stopped.\n\nIf *count* is ``None`` (the default), wait for all *objects*\nto become ready.\n\nIf *count* is a number, wait for (up to) *count* objects to become\nready. (For example, if count is ``1`` then the function exits\nwhen any object in the list is ready).\n\nIf *timeout* is provided, it specifies the maximum number of\nseconds ``wait()`` will block.\n\nReturns the list of ready objects, in the order in which they were\nready.\n\n.. seealso:: :func:`iwait`");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_3wait_on_objects = {"wait_on_objects", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_3wait_on_objects, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_2wait_on_objects};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_3wait_on_objects(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_objects = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_count = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_on_objects (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_objects,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_count,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 250, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_on_objects", 0) < 0) __PYX_ERR(0, 250, __pyx_L3_error)
          if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
        } else {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 250, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
        }
        __pyx_v_objects = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_count = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_on_objects", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 250, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_2wait_on_objects(__pyx_self, __pyx_v_objects, __pyx_v_timeout, __pyx_v_count);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_2wait_on_objects(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objects, PyObject *__pyx_v_timeout, PyObject *__pyx_v_count) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.objects = __pyx_v_objects;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.count = __pyx_v_count;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_objects(1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __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._gevent_c_hub_primitives.wait_on_objects", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_3wait_on_objects, 0, __pyx_mstate_global->__pyx_n_u_wait_on_objects, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_on_objects, __pyx_t_4) < 0) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     251:     """

     252:     Wait for *objects* to become ready or for event loop to finish.

     253:

     254:     If *objects* is provided, it must be a list containing objects

     255:     implementing the wait protocol (rawlink() and unlink() methods):

     256:

     257:     - :class:`gevent.Greenlet` instance

     258:     - :class:`gevent.event.Event` instance

     259:     - :class:`gevent.lock.Semaphore` instance

     260:     - :class:`gevent.subprocess.Popen` instance

     261:

     262:     If *objects* is ``None`` (the default), ``wait()`` blocks until

     263:     the current event loop has nothing to do (or until *timeout* passes):

     264:

     265:     - all greenlets have finished

     266:     - all servers were stopped

     267:     - all event loop watchers were stopped.

     268:

     269:     If *count* is ``None`` (the default), wait for all *objects*

     270:     to become ready.

     271:

     272:     If *count* is a number, wait for (up to) *count* objects to become

     273:     ready. (For example, if count is ``1`` then the function exits

     274:     when any object in the list is ready).

     275:

     276:     If *timeout* is provided, it specifies the maximum number of

     277:     seconds ``wait()`` will block.

     278:

     279:     Returns the list of ready objects, in the order in which they were

     280:     ready.

     281:

     282:     .. seealso:: :func:`iwait`

     283:     """

    +284:     if objects is None:

      __pyx_t_1 = (__pyx_v_objects == Py_None);
      if (__pyx_t_1) {
    /* … */
      }

    +285:         hub = get_hub()

        __pyx_t_2 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_v_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_2);
        __pyx_t_2 = 0;

    +286:         return hub.join(timeout=timeout) # pylint:disable=

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = ((PyObject *)__pyx_v_hub);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
          __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_timeout, __pyx_v_timeout, __pyx_t_5, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
          __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_join, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;

    +287:     return list(iwait_on_objects(objects, timeout, count))

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6.__pyx_n = 2;
      __pyx_t_6.timeout = __pyx_v_timeout;
      __pyx_t_6.count = __pyx_v_count;
      __pyx_t_2 = __pyx_f_6gevent_24_gevent_c_hub_primitives_iwait_on_objects(__pyx_v_objects, 0, &__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PySequence_ListKeepNew(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

     288:

    +289: _timeout_error = Exception

      __Pyx_INCREF((PyObject *)(((PyTypeObject*)PyExc_Exception)));
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error, ((PyObject *)(((PyTypeObject*)PyExc_Exception))));
      __Pyx_GIVEREF((PyObject *)(((PyTypeObject*)PyExc_Exception)));

     290:

    +291: def set_default_timeout_error(e):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_5set_default_timeout_error(PyObject *__pyx_self, PyObject *__pyx_v_e); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_4set_default_timeout_error, "set_default_timeout_error(e)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_5set_default_timeout_error = {"set_default_timeout_error", (PyCFunction)__pyx_pw_6gevent_24_gevent_c_hub_primitives_5set_default_timeout_error, METH_O, __pyx_doc_6gevent_24_gevent_c_hub_primitives_4set_default_timeout_error};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_5set_default_timeout_error(PyObject *__pyx_self, PyObject *__pyx_v_e) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("set_default_timeout_error (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_4set_default_timeout_error(__pyx_self, ((PyObject *)__pyx_v_e));

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_4set_default_timeout_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e) {
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_5set_default_timeout_error, 0, __pyx_mstate_global->__pyx_n_u_set_default_timeout_error, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_set_default_timeout_error, __pyx_t_4) < 0) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     292:     global _timeout_error

    +293:     _timeout_error = e

      __Pyx_INCREF(__pyx_v_e);
      __Pyx_XGOTREF(__pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error);
      __Pyx_DECREF_SET(__pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);

     294:

    +295: def _primitive_wait(watcher, timeout, timeout_exc, hub):

    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives__primitive_wait(PyObject *__pyx_v_watcher, PyObject *__pyx_v_timeout, PyObject *__pyx_v_timeout_exc, struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_hub) {
      PyObject *__pyx_r = NULL;
      __Pyx_INCREF(__pyx_v_timeout);
      __Pyx_INCREF((PyObject *)__pyx_v_hub);
    /* … */
      /* 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_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._primitive_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_timeout);
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +296:     if watcher.callback is not None:

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = (__pyx_t_1 != Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_t_2)) {
    /* … */
      }

    +297:         raise ConcurrentObjectUseError('This socket is already used by another greenlet: %r'

        __pyx_t_3 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_ConcurrentObjectUseError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
    /* … */
        __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_This_socket_is_already_used_by_a, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 297, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 297, __pyx_L1_error)

    +298:                                        % (watcher.callback, ))

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_watcher, __pyx_mstate_global->__pyx_n_u_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_5), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     299:

    +300:     if hub is None:

      __pyx_t_2 = (((PyObject *)__pyx_v_hub) == Py_None);
      if (__pyx_t_2) {
    /* … */
      }

    +301:         hub = get_hub()

        __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet))))) __PYX_ERR(0, 301, __pyx_L1_error)
        __Pyx_DECREF_SET(__pyx_v_hub, ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_t_1));
        __pyx_t_1 = 0;

     302:

    +303:     if timeout is None:

      __pyx_t_2 = (__pyx_v_timeout == Py_None);
      if (__pyx_t_2) {
    /* … */
      }

    +304:         hub.wait(watcher)

        __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_hub->__pyx_base.__pyx_vtab)->wait(__pyx_v_hub, __pyx_v_watcher, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +305:         return

        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

     306:

    +307:     timeout = Timeout._start_new_or_dummy(

      __pyx_t_4 = __pyx_v_6gevent_24_gevent_c_hub_primitives_Timeout;
      __Pyx_INCREF(__pyx_t_4);

     308:         timeout,

    +309:         (timeout_exc

        __Pyx_INCREF(__pyx_v_timeout_exc);
        __pyx_t_5 = __pyx_v_timeout_exc;
      } else {

    +310:          if timeout_exc is not _NONE or timeout is None

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = (__pyx_v_timeout_exc != __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_8) {
      } else {
        __pyx_t_2 = __pyx_t_8;
        goto __pyx_L6_bool_binop_done;
      }
      __pyx_t_8 = (__pyx_v_timeout == Py_None);
      __pyx_t_2 = __pyx_t_8;
      __pyx_L6_bool_binop_done:;
      if (__pyx_t_2) {

    +311:          else _timeout_error('timed out')))

        __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error);
        __pyx_t_9 = __pyx_v_6gevent_24_gevent_c_hub_primitives__timeout_error;
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
          assert(__pyx_t_6);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_timed_out};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_5 = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_timeout, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start_new_or_dummy, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1);
      __pyx_t_1 = 0;

     312:

    +313:     with timeout:

      /*with:*/ {
        __pyx_t_10 = __Pyx_PyObject_LookupSpecial(__pyx_v_timeout, __pyx_mstate_global->__pyx_n_u_exit); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 313, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_5 = NULL;
        __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_v_timeout, __pyx_mstate_global->__pyx_n_u_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = 1;
        #if CYTHON_UNPACK_METHODS
        if (likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_5);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_7 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        /*try:*/ {
          {
            /*try:*/ {
    /* … */
            }
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            goto __pyx_L17_try_end;
            __pyx_L12_error:;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            /*except:*/ {
              __Pyx_AddTraceback("gevent._gevent_c_hub_primitives._primitive_wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
              if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 313, __pyx_L14_except_error)
              __Pyx_XGOTREF(__pyx_t_1);
              __Pyx_XGOTREF(__pyx_t_4);
              __Pyx_XGOTREF(__pyx_t_5);
              __pyx_t_3 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L14_except_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 313, __pyx_L14_except_error)
              __Pyx_GOTREF(__pyx_t_14);
              __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              if (__pyx_t_2 < 0) __PYX_ERR(0, 313, __pyx_L14_except_error)
              __pyx_t_8 = (!__pyx_t_2);
              if (unlikely(__pyx_t_8)) {
                __Pyx_GIVEREF(__pyx_t_1);
                __Pyx_GIVEREF(__pyx_t_4);
                __Pyx_XGIVEREF(__pyx_t_5);
                __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_4, __pyx_t_5);
                __pyx_t_1 = 0;  __pyx_t_4 = 0;  __pyx_t_5 = 0;
                __PYX_ERR(0, 313, __pyx_L14_except_error)
              }
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              goto __pyx_L13_exception_handled;
            }
            __pyx_L14_except_error:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            goto __pyx_L1_error;
            __pyx_L13_exception_handled:;
            __Pyx_XGIVEREF(__pyx_t_11);
            __Pyx_XGIVEREF(__pyx_t_12);
            __Pyx_XGIVEREF(__pyx_t_13);
            __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
            __pyx_L17_try_end:;
          }
        }
        /*finally:*/ {
          /*normal exit:*/{
            if (__pyx_t_10) {
              __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_mstate_global->__pyx_tuple[0], NULL);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 313, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            }
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
        goto __pyx_L21;
        __pyx_L8_error:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L1_error;
        __pyx_L21:;
      }
    /* … */
      __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

    +314:         hub.wait(watcher)

              __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_hub->__pyx_base.__pyx_vtab)->wait(__pyx_v_hub, __pyx_v_watcher, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L12_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     315:

     316: # Suitable to be bound as an instance method

    +317: def wait_on_socket(socket, watcher, timeout_exc=None):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_7wait_on_socket(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_socket(PyObject *__pyx_v_socket, PyObject *__pyx_v_watcher, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_on_socket *__pyx_optional_args) {
      PyObject *__pyx_v_timeout_exc = ((PyObject *)Py_None);
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout_exc = __pyx_optional_args->timeout_exc;
        }
      }
    /* … */
      /* 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_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_socket", __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_24_gevent_c_hub_primitives_7wait_on_socket(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_6wait_on_socket, "wait_on_socket(socket, watcher, timeout_exc=None)");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_7wait_on_socket = {"wait_on_socket", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_7wait_on_socket, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_6wait_on_socket};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_7wait_on_socket(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_socket = 0;
      PyObject *__pyx_v_watcher = 0;
      PyObject *__pyx_v_timeout_exc = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_on_socket (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_socket,&__pyx_mstate_global->__pyx_n_u_watcher,&__pyx_mstate_global->__pyx_n_u_timeout_exc,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 317, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 317, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 317, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 317, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_on_socket", 0) < 0) __PYX_ERR(0, 317, __pyx_L3_error)
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wait_on_socket", 0, 2, 3, i); __PYX_ERR(0, 317, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 317, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 317, __pyx_L3_error)
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 317, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
        }
        __pyx_v_socket = values[0];
        __pyx_v_watcher = values[1];
        __pyx_v_timeout_exc = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_on_socket", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 317, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_6wait_on_socket(__pyx_self, __pyx_v_socket, __pyx_v_watcher, __pyx_v_timeout_exc);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_6wait_on_socket(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_socket, PyObject *__pyx_v_watcher, PyObject *__pyx_v_timeout_exc) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.timeout_exc = __pyx_v_timeout_exc;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_socket(__pyx_v_socket, __pyx_v_watcher, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __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._gevent_c_hub_primitives.wait_on_socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_7wait_on_socket, 0, __pyx_mstate_global->__pyx_n_u_wait_on_socket, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[3]);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_on_socket, __pyx_t_4) < 0) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +318:     if socket is None or watcher is None:

      __pyx_t_2 = (__pyx_v_socket == Py_None);
      if (!__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = (__pyx_v_watcher == Py_None);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L4_bool_binop_done:;
      if (unlikely(__pyx_t_1)) {
    /* … */
      }

     319:         # test__hub TestCloseSocketWhilePolling, on Python 2; Python 3

     320:         # catches the EBADF differently.

    +321:         raise ConcurrentObjectUseError("The socket has already been closed by another greenlet")

        __pyx_t_4 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ConcurrentObjectUseError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 321, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
          assert(__pyx_t_4);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
          __pyx_t_6 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_The_socket_has_already_been_clos};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(0, 321, __pyx_L1_error)

    +322:     _primitive_wait(watcher, socket.timeout,

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_socket, __pyx_mstate_global->__pyx_n_u_timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    /* … */
      __pyx_t_7 = __pyx_f_6gevent_24_gevent_c_hub_primitives__primitive_wait(__pyx_v_watcher, __pyx_t_3, __pyx_t_5, ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    +323:                     timeout_exc if timeout_exc is not None else _NONE,

      __pyx_t_1 = (__pyx_v_timeout_exc != Py_None);
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_v_timeout_exc);
        __pyx_t_5 = __pyx_v_timeout_exc;
      } else {
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 323, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __pyx_t_4;
        __pyx_t_4 = 0;
      }

    +324:                     socket.hub)

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_socket, __pyx_mstate_global->__pyx_n_u_hub); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 324, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet))))) __PYX_ERR(0, 324, __pyx_L1_error)

     325:

    +326: def wait_on_watcher(watcher, timeout=None, timeout_exc=_NONE, hub=None):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_9wait_on_watcher(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_watcher(PyObject *__pyx_v_watcher, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_on_watcher *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_timeout_exc = __pyx_mstate_global->__pyx_k__2;
      struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_hub = ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)Py_None);
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_timeout_exc = __pyx_optional_args->timeout_exc;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_hub = __pyx_optional_args->hub;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_watcher", __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_24_gevent_c_hub_primitives_9wait_on_watcher(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_8wait_on_watcher, "wait_on_watcher(watcher, timeout=None, timeout_exc=_NONE, WaitOperationsGreenlet hub=None)\n\nwait(watcher, timeout=None, [timeout_exc=None]) -> None\n\nBlock the current greenlet until *watcher* is ready.\n\nIf *timeout* is non-negative, then *timeout_exc* is raised after\n*timeout* second has passed.\n\nIf :func:`cancel_wait` is called on *watcher* by another greenlet,\nraise an exception in this blocking greenlet\n(``socket.error(EBADF, 'File descriptor was closed in another\ngreenlet')`` by default).\n\n:param watcher: An event loop watcher, most commonly an IO watcher obtained from\n    :meth:`gevent.core.loop.io`\n:keyword timeout_exc: The exception to raise if the timeout expires.\n    By default, a :class:`socket.timeout` exception is raised.\n    If you pass a value for this keyword, it is interpreted as for\n    :class:`gevent.timeout.Timeout`.\n\n:raises ~gevent.hub.ConcurrentObjectUseError: If the *watcher* is\n    already started.");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_9wait_on_watcher = {"wait_on_watcher", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_9wait_on_watcher, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_8wait_on_watcher};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_9wait_on_watcher(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_watcher = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_timeout_exc = 0;
      struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_hub = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_on_watcher (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_watcher,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_timeout_exc,&__pyx_mstate_global->__pyx_n_u_hub,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 326, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_on_watcher", 0) < 0) __PYX_ERR(0, 326, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__2);
          if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)Py_None));
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wait_on_watcher", 0, 1, 4, i); __PYX_ERR(0, 326, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 326, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 326, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__2);
          if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)Py_None));
        }
        __pyx_v_watcher = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_timeout_exc = values[2];
        __pyx_v_hub = ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)values[3]);
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_on_watcher", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 326, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_on_watcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hub), __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet, 1, "hub", 0))) __PYX_ERR(0, 326, __pyx_L1_error)
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_8wait_on_watcher(__pyx_self, __pyx_v_watcher, __pyx_v_timeout, __pyx_v_timeout_exc, __pyx_v_hub);

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      goto __pyx_L7_cleaned_up;
      __pyx_L0:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __pyx_L7_cleaned_up:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_8wait_on_watcher(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_watcher, PyObject *__pyx_v_timeout, PyObject *__pyx_v_timeout_exc, struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *__pyx_v_hub) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.timeout_exc = __pyx_v_timeout_exc;
      __pyx_t_2.hub = __pyx_v_hub;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_watcher(__pyx_v_watcher, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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._gevent_c_hub_primitives.wait_on_watcher", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_mstate_global->__pyx_k__2 = __pyx_t_4;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_Pack(3, Py_None, __pyx_t_4, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_9wait_on_watcher, 0, __pyx_mstate_global->__pyx_n_u_wait_on_watcher, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_on_watcher, __pyx_t_4) < 0) __PYX_ERR(0, 326, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     327:     """

     328:     wait(watcher, timeout=None, [timeout_exc=None]) -> None

     329:

     330:     Block the current greenlet until *watcher* is ready.

     331:

     332:     If *timeout* is non-negative, then *timeout_exc* is raised after

     333:     *timeout* second has passed.

     334:

     335:     If :func:`cancel_wait` is called on *watcher* by another greenlet,

     336:     raise an exception in this blocking greenlet

     337:     (``socket.error(EBADF, 'File descriptor was closed in another

     338:     greenlet')`` by default).

     339:

     340:     :param watcher: An event loop watcher, most commonly an IO watcher obtained from

     341:         :meth:`gevent.core.loop.io`

     342:     :keyword timeout_exc: The exception to raise if the timeout expires.

     343:         By default, a :class:`socket.timeout` exception is raised.

     344:         If you pass a value for this keyword, it is interpreted as for

     345:         :class:`gevent.timeout.Timeout`.

     346:

     347:     :raises ~gevent.hub.ConcurrentObjectUseError: If the *watcher* is

     348:         already started.

     349:     """

    +350:     _primitive_wait(watcher, timeout, timeout_exc, hub)

      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives__primitive_wait(__pyx_v_watcher, __pyx_v_timeout, __pyx_v_timeout_exc, __pyx_v_hub); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     351:

     352:

    +353: def wait_read(fileno, timeout=None, timeout_exc=_NONE):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_11wait_read(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_read(PyObject *__pyx_v_fileno, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_read *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_timeout_exc = __pyx_mstate_global->__pyx_k__3;
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL;
      PyObject *__pyx_v_io = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_timeout_exc = __pyx_optional_args->timeout_exc;
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XDECREF(__pyx_v_io);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_11wait_read(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_10wait_read, "wait_read(fileno, timeout=None, timeout_exc=_NONE)\n\nwait_read(fileno, timeout=None, [timeout_exc=None]) -> None\n\nBlock the current greenlet until *fileno* is ready to read.\n\nFor the meaning of the other parameters and possible exceptions,\nsee :func:`wait`.\n\n.. seealso:: :func:`cancel_wait`");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_11wait_read = {"wait_read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_11wait_read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_10wait_read};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_11wait_read(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_fileno = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_timeout_exc = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_read (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fileno,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_timeout_exc,0};
      PyObject* values[3] = {0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 353, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 353, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 353, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 353, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_read", 0) < 0) __PYX_ERR(0, 353, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__3);
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wait_read", 0, 1, 3, i); __PYX_ERR(0, 353, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 353, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 353, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 353, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__3);
        }
        __pyx_v_fileno = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_timeout_exc = values[2];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_read", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 353, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_10wait_read(__pyx_self, __pyx_v_fileno, __pyx_v_timeout, __pyx_v_timeout_exc);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_10wait_read(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fileno, PyObject *__pyx_v_timeout, PyObject *__pyx_v_timeout_exc) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 2;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.timeout_exc = __pyx_v_timeout_exc;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_read(__pyx_v_fileno, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 353, __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._gevent_c_hub_primitives.wait_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_mstate_global->__pyx_k__3 = __pyx_t_4;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_Pack(2, Py_None, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_11wait_read, 0, __pyx_mstate_global->__pyx_n_u_wait_read, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_read, __pyx_t_4) < 0) __PYX_ERR(0, 353, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     354:     """

     355:     wait_read(fileno, timeout=None, [timeout_exc=None]) -> None

     356:

     357:     Block the current greenlet until *fileno* is ready to read.

     358:

     359:     For the meaning of the other parameters and possible exceptions,

     360:     see :func:`wait`.

     361:

     362:     .. seealso:: :func:`cancel_wait`

     363:     """

    +364:     hub = get_hub()

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +365:     io = hub.loop.io(fileno, 1)

      __pyx_t_2 = __pyx_v_hub->loop;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_fileno, __pyx_mstate_global->__pyx_int_1};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_io, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_io = __pyx_t_1;
      __pyx_t_1 = 0;

    +366:     try:

      /*try:*/ {

    +367:         return wait_on_watcher(io, timeout, timeout_exc, hub)

        __Pyx_XDECREF(__pyx_r);
        if (!(likely(((((PyObject *)__pyx_v_hub)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_hub), __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet))))) __PYX_ERR(0, 367, __pyx_L4_error)
        __pyx_t_4.__pyx_n = 3;
        __pyx_t_4.timeout = __pyx_v_timeout;
        __pyx_t_4.timeout_exc = __pyx_v_timeout_exc;
        __pyx_t_4.hub = ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_hub);
        __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_watcher(__pyx_v_io, 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L3_return;
      }

     368:     finally:

    +369:         io.close()

      /*finally:*/ {
        __pyx_L4_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
          {
            __pyx_t_2 = __pyx_v_io;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
          goto __pyx_L1_error;
          __pyx_L7_error:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L3_return: {
          __pyx_t_13 = __pyx_r;
          __pyx_r = 0;
          __pyx_t_2 = __pyx_v_io;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = __pyx_t_13;
          __pyx_t_13 = 0;
          goto __pyx_L0;
        }
      }

     370:

     371:

    +372: def wait_write(fileno, timeout=None, timeout_exc=_NONE, event=_NONE):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13wait_write(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_write(PyObject *__pyx_v_fileno, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_write *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_timeout_exc = __pyx_mstate_global->__pyx_k__4;
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL;
      PyObject *__pyx_v_io = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_timeout_exc = __pyx_optional_args->timeout_exc;
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XDECREF(__pyx_v_io);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13wait_write(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_12wait_write, "wait_write(fileno, timeout=None, timeout_exc=_NONE, event=_NONE)\n\nwait_write(fileno, timeout=None, [timeout_exc=None]) -> None\n\nBlock the current greenlet until *fileno* is ready to write.\n\nFor the meaning of the other parameters and possible exceptions,\nsee :func:`wait`.\n\n.. deprecated:: 1.1\n   The keyword argument *event* is ignored. Applications should not pass this parameter.\n   In the future, doing so will become an error.\n\n.. seealso:: :func:`cancel_wait`");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_13wait_write = {"wait_write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_13wait_write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_12wait_write};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_13wait_write(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_fileno = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_timeout_exc = 0;
      PyObject *__pyx_v_event = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_write (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fileno,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_timeout_exc,&__pyx_mstate_global->__pyx_n_u_event,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 372, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_write", 0) < 0) __PYX_ERR(0, 372, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__4);
          if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__5);
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wait_write", 0, 1, 4, i); __PYX_ERR(0, 372, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 372, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 372, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__4);
          if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__5);
        }
        __pyx_v_fileno = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_timeout_exc = values[2];
        __pyx_v_event = values[3];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_write", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 372, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_12wait_write(__pyx_self, __pyx_v_fileno, __pyx_v_timeout, __pyx_v_timeout_exc, __pyx_v_event);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_12wait_write(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fileno, PyObject *__pyx_v_timeout, PyObject *__pyx_v_timeout_exc, PyObject *__pyx_v_event) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.timeout_exc = __pyx_v_timeout_exc;
      __pyx_t_2.event = __pyx_v_event;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_write(__pyx_v_fileno, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __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._gevent_c_hub_primitives.wait_write", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_mstate_global->__pyx_k__4 = __pyx_t_4;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_mstate_global->__pyx_k__5 = __pyx_t_4;
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_Pack(3, Py_None, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_13wait_write, 0, __pyx_mstate_global->__pyx_n_u_wait_write, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_write, __pyx_t_3) < 0) __PYX_ERR(0, 372, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     373:     """

     374:     wait_write(fileno, timeout=None, [timeout_exc=None]) -> None

     375:

     376:     Block the current greenlet until *fileno* is ready to write.

     377:

     378:     For the meaning of the other parameters and possible exceptions,

     379:     see :func:`wait`.

     380:

     381:     .. deprecated:: 1.1

     382:        The keyword argument *event* is ignored. Applications should not pass this parameter.

     383:        In the future, doing so will become an error.

     384:

     385:     .. seealso:: :func:`cancel_wait`

     386:     """

     387:     # pylint:disable=unused-argument

    +388:     hub = get_hub()

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +389:     io = hub.loop.io(fileno, 2)

      __pyx_t_2 = __pyx_v_hub->loop;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_fileno, __pyx_mstate_global->__pyx_int_2};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_io, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_io = __pyx_t_1;
      __pyx_t_1 = 0;

    +390:     try:

      /*try:*/ {

    +391:         return wait_on_watcher(io, timeout, timeout_exc, hub)

        __Pyx_XDECREF(__pyx_r);
        if (!(likely(((((PyObject *)__pyx_v_hub)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_hub), __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet))))) __PYX_ERR(0, 391, __pyx_L4_error)
        __pyx_t_4.__pyx_n = 3;
        __pyx_t_4.timeout = __pyx_v_timeout;
        __pyx_t_4.timeout_exc = __pyx_v_timeout_exc;
        __pyx_t_4.hub = ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_hub);
        __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_watcher(__pyx_v_io, 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L3_return;
      }

     392:     finally:

    +393:         io.close()

      /*finally:*/ {
        __pyx_L4_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
          {
            __pyx_t_2 = __pyx_v_io;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
          goto __pyx_L1_error;
          __pyx_L7_error:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L3_return: {
          __pyx_t_13 = __pyx_r;
          __pyx_r = 0;
          __pyx_t_2 = __pyx_v_io;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = __pyx_t_13;
          __pyx_t_13 = 0;
          goto __pyx_L0;
        }
      }

     394:

     395:

    +396: def wait_readwrite(fileno, timeout=None, timeout_exc=_NONE, event=_NONE):

    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_15wait_readwrite(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyObject *__pyx_f_6gevent_24_gevent_c_hub_primitives_wait_readwrite(PyObject *__pyx_v_fileno, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_24_gevent_c_hub_primitives_wait_readwrite *__pyx_optional_args) {
      PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
      PyObject *__pyx_v_timeout_exc = __pyx_mstate_global->__pyx_k__6;
      struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL;
      PyObject *__pyx_v_io = NULL;
      PyObject *__pyx_r = NULL;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_timeout = __pyx_optional_args->timeout;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_timeout_exc = __pyx_optional_args->timeout_exc;
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_readwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_hub);
      __Pyx_XDECREF(__pyx_v_io);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_15wait_readwrite(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_14wait_readwrite, "wait_readwrite(fileno, timeout=None, timeout_exc=_NONE, event=_NONE)\n\nwait_readwrite(fileno, timeout=None, [timeout_exc=None]) -> None\n\nBlock the current greenlet until *fileno* is ready to read or\nwrite.\n\nFor the meaning of the other parameters and possible exceptions,\nsee :func:`wait`.\n\n.. deprecated:: 1.1\n   The keyword argument *event* is ignored. Applications should not pass this parameter.\n   In the future, doing so will become an error.\n\n.. seealso:: :func:`cancel_wait`");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_15wait_readwrite = {"wait_readwrite", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_24_gevent_c_hub_primitives_15wait_readwrite, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_14wait_readwrite};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_15wait_readwrite(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_fileno = 0;
      PyObject *__pyx_v_timeout = 0;
      PyObject *__pyx_v_timeout_exc = 0;
      PyObject *__pyx_v_event = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wait_readwrite (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fileno,&__pyx_mstate_global->__pyx_n_u_timeout,&__pyx_mstate_global->__pyx_n_u_timeout_exc,&__pyx_mstate_global->__pyx_n_u_event,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 396, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "wait_readwrite", 0) < 0) __PYX_ERR(0, 396, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6);
          if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7);
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("wait_readwrite", 0, 1, 4, i); __PYX_ERR(0, 396, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 396, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 396, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
          if (!values[2]) values[2] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6);
          if (!values[3]) values[3] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7);
        }
        __pyx_v_fileno = values[0];
        __pyx_v_timeout = values[1];
        __pyx_v_timeout_exc = values[2];
        __pyx_v_event = values[3];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wait_readwrite", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 396, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_hub_primitives.wait_readwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_14wait_readwrite(__pyx_self, __pyx_v_fileno, __pyx_v_timeout, __pyx_v_timeout_exc, __pyx_v_event);

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_14wait_readwrite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fileno, PyObject *__pyx_v_timeout, PyObject *__pyx_v_timeout_exc, PyObject *__pyx_v_event) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.timeout = __pyx_v_timeout;
      __pyx_t_2.timeout_exc = __pyx_v_timeout_exc;
      __pyx_t_2.event = __pyx_v_event;
      __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_readwrite(__pyx_v_fileno, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __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._gevent_c_hub_primitives.wait_readwrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_mstate_global->__pyx_k__6 = __pyx_t_3;
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_mstate_global->__pyx_k__7 = __pyx_t_3;
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_Pack(3, Py_None, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_15wait_readwrite, 0, __pyx_mstate_global->__pyx_n_u_wait_readwrite, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wait_readwrite, __pyx_t_2) < 0) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     397:     """

     398:     wait_readwrite(fileno, timeout=None, [timeout_exc=None]) -> None

     399:

     400:     Block the current greenlet until *fileno* is ready to read or

     401:     write.

     402:

     403:     For the meaning of the other parameters and possible exceptions,

     404:     see :func:`wait`.

     405:

     406:     .. deprecated:: 1.1

     407:        The keyword argument *event* is ignored. Applications should not pass this parameter.

     408:        In the future, doing so will become an error.

     409:

     410:     .. seealso:: :func:`cancel_wait`

     411:     """

     412:     # pylint:disable=unused-argument

    +413:     hub = get_hub()

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_hub = ((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1);
      __pyx_t_1 = 0;

    +414:     io = hub.loop.io(fileno, 3)

      __pyx_t_2 = __pyx_v_hub->loop;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_fileno, __pyx_mstate_global->__pyx_int_3};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_io, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_io = __pyx_t_1;
      __pyx_t_1 = 0;

    +415:     try:

      /*try:*/ {

    +416:         return wait_on_watcher(io, timeout, timeout_exc, hub)

        __Pyx_XDECREF(__pyx_r);
        if (!(likely(((((PyObject *)__pyx_v_hub)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_hub), __pyx_mstate_global->__pyx_ptype_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet))))) __PYX_ERR(0, 416, __pyx_L4_error)
        __pyx_t_4.__pyx_n = 3;
        __pyx_t_4.timeout = __pyx_v_timeout;
        __pyx_t_4.timeout_exc = __pyx_v_timeout_exc;
        __pyx_t_4.hub = ((struct __pyx_obj_6gevent_24_gevent_c_hub_primitives_WaitOperationsGreenlet *)__pyx_v_hub);
        __pyx_t_1 = __pyx_f_6gevent_24_gevent_c_hub_primitives_wait_on_watcher(__pyx_v_io, 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L3_return;
      }

     417:     finally:

    +418:         io.close()

      /*finally:*/ {
        __pyx_L4_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
          if ( unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_13);
          __pyx_t_5 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename;
          {
            __pyx_t_2 = __pyx_v_io;
            __Pyx_INCREF(__pyx_t_2);
            __pyx_t_3 = 0;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7;
          goto __pyx_L1_error;
          __pyx_L7_error:;
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L3_return: {
          __pyx_t_13 = __pyx_r;
          __pyx_r = 0;
          __pyx_t_2 = __pyx_v_io;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_3 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
            __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = __pyx_t_13;
          __pyx_t_13 = 0;
          goto __pyx_L0;
        }
      }

     419:

     420:

    +421: def _init():

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_17_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_24_gevent_c_hub_primitives_16_init, "_init()");
    static PyMethodDef __pyx_mdef_6gevent_24_gevent_c_hub_primitives_17_init = {"_init", (PyCFunction)__pyx_pw_6gevent_24_gevent_c_hub_primitives_17_init, METH_NOARGS, __pyx_doc_6gevent_24_gevent_c_hub_primitives_16_init};
    static PyObject *__pyx_pw_6gevent_24_gevent_c_hub_primitives_17_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_init (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_24_gevent_c_hub_primitives_16_init(__pyx_self);

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

    static PyObject *__pyx_pf_6gevent_24_gevent_c_hub_primitives_16_init(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_24_gevent_c_hub_primitives_17_init, 0, __pyx_mstate_global->__pyx_n_u_init, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_hub_primitives, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_init, __pyx_t_2) < 0) __PYX_ERR(0, 421, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +422:     greenlet_init() # pylint:disable=undefined-variable

      __pyx_f_6gevent_24_gevent_c_hub_primitives_greenlet_init(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error)

     423:

    +424: _init()

      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     425:

    +426: from gevent._util import import_c_accel

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +427: import_c_accel(globals(), 'gevent.__hub_primitives')

      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_Globals(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_6, __pyx_mstate_global->__pyx_kp_u_gevent___hub_primitives};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;