Generated by Cython 0.29.2

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

Raw output: _abstract_linkable.c

+001: # -*- coding: utf-8 -*-
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 002: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
 003: """
 004: Internal module, support for the linkable protocol for "event" like objects.
 005: 
 006: """
 007: from __future__ import absolute_import
 008: from __future__ import division
 009: from __future__ import print_function
 010: 
+011: import sys
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 012: 
+013: from gevent._hub_local import get_hub_noargs as get_hub
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_get_hub_noargs);
  __Pyx_GIVEREF(__pyx_n_s_get_hub_noargs);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_hub_noargs);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__hub_local, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_hub_noargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hub_noargs, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 014: 
+015: from gevent.exceptions import InvalidSwitchError
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_InvalidSwitchError);
  __Pyx_GIVEREF(__pyx_n_s_InvalidSwitchError);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_InvalidSwitchError);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent_exceptions, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_6gevent_19__abstract_linkable_InvalidSwitchError);
  __Pyx_DECREF_SET(__pyx_v_6gevent_19__abstract_linkable_InvalidSwitchError, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+016: from gevent.timeout import Timeout
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Timeout);
  __Pyx_GIVEREF(__pyx_n_s_Timeout);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Timeout);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_timeout, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_6gevent_19__abstract_linkable_Timeout);
  __Pyx_DECREF_SET(__pyx_v_6gevent_19__abstract_linkable_Timeout, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 017: 
+018: locals()['getcurrent'] = __import__('greenlet').getcurrent
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyDict_SetItem(__pyx_t_2, __pyx_n_s_getcurrent, __pyx_t_1) < 0)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);
+019: locals()['greenlet_init'] = lambda: None
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_lambda, METH_NOARGS, 0};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_6gevent_19__abstract_linkable_lambda(__pyx_self);

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

static PyObject *__pyx_lambda_funcdef_6gevent_19__abstract_linkable_lambda(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda", 0);
  __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_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyDict_SetItem(__pyx_t_2, __pyx_n_s_greenlet_init, __pyx_t_1) < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 020: 
+021: __all__ = [
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_AbstractLinkable);
  __Pyx_GIVEREF(__pyx_n_s_AbstractLinkable);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_AbstractLinkable);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 022:     'AbstractLinkable',
 023: ]
 024: 
+025: class AbstractLinkable(object):
struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable {
  PyObject *(*rawlink)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, PyObject *, int __pyx_skip_dispatch);
  int (*ready)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
  PyObject *(*unlink)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*_check_and_notify)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *);
  PyObject *(*_notify_links)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, int __pyx_skip_dispatch);
  PyObject *(*_wait_core)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, PyObject *, struct __pyx_opt_args_6gevent_19__abstract_linkable_16AbstractLinkable__wait_core *__pyx_optional_args);
  PyObject *(*_wait_return_value)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, PyObject *, PyObject *);
  PyObject *(*_wait)(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *, struct __pyx_opt_args_6gevent_19__abstract_linkable_16AbstractLinkable__wait *__pyx_optional_args);
};
static struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_vtabptr_6gevent_19__abstract_linkable_AbstractLinkable;
 026:     # Encapsulates the standard parts of the linking and notifying
 027:     # protocol common to both repeatable events (Event, Semaphore) and
 028:     # one-time events (AsyncResult).
 029: 
+030:     __slots__ = ('hub', '_links', '_notifier', '_notify_all', '__weakref__')
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_slots, __pyx_tuple__4) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
/* … */
  __pyx_tuple__4 = PyTuple_Pack(5, __pyx_n_s_hub, __pyx_n_s_links, __pyx_n_s_notifier, __pyx_n_s_notify_all, __pyx_n_s_weakref); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
 031: 
+032:     def __init__(self):
/* Python wrapper */
static int __pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable___init__(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self));

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

static int __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable___init__(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);
/* … */
  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 033:         # Before this implementation, AsyncResult and Semaphore
 034:         # maintained the order of notifications, but Event did not.
 035: 
 036:         # In gevent 1.3, before Semaphore extended this class,
 037:         # that was changed to not maintain the order. It was done because
 038:         # Event guaranteed to only call callbacks once (a set) but
 039:         # AsyncResult had no such guarantees.
 040: 
 041:         # Semaphore likes to maintain order of callbacks, though,
 042:         # so when it was added we went back to a list implementation
 043:         # for storing callbacks. But we want to preserve the unique callback
 044:         # property, so we manually check.
 045: 
 046:         # We generally don't expect to have so many waiters (for any of those
 047:         # objects) that testing membership and removing is a bottleneck.
 048: 
 049:         # In PyPy 2.6.1 with Cython 0.23, `cdef public` or `cdef
 050:         # readonly` or simply `cdef` attributes of type `object` can appear to leak if
 051:         # a Python subclass is used (this is visible simply
 052:         # instantiating this subclass if _links=[]). Our _links and
 053:         # _notifier are such attributes, and gevent.thread subclasses
 054:         # this class. Thus, we carefully manage the lifetime of the
 055:         # objects we put in these attributes so that, in the normal
 056:         # case of a semaphore used correctly (deallocated when it's not
 057:         # locked and no one is waiting), the leak goes away (because
 058:         # these objects are back to None). This can also be solved on PyPy
 059:         # by simply not declaring these objects in the pxd file, but that doesn't work for
 060:         # CPython ("No attribute...")
 061:         # See https://github.com/gevent/gevent/issues/660
+062:         self._links = set()
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->_links);
  __Pyx_DECREF(__pyx_v_self->_links);
  __pyx_v_self->_links = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+063:         self._notifier = None
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->_notifier);
  __Pyx_DECREF(__pyx_v_self->_notifier);
  __pyx_v_self->_notifier = Py_None;
 064:         # This is conceptually a class attribute, defined here for ease of access in
 065:         # cython. If it's true, when notifiers fire, all existing callbacks are called.
 066:         # If its false, we only call callbacks as long as ready() returns true.
+067:         self._notify_all = True
  __pyx_v_self->_notify_all = 1;
 068:         # we don't want to do get_hub() here to allow defining module-level objects
 069:         # without initializing the hub
+070:         self.hub = None
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->hub);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->hub));
  __pyx_v_self->hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)Py_None);
 071: 
+072:     def linkcount(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_3linkcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_2linkcount[] = "AbstractLinkable.linkcount(self)";
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_3linkcount = {"linkcount", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_3linkcount, METH_NOARGS, __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_2linkcount};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_3linkcount(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("linkcount (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_2linkcount(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self));

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

static PyObject *__pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_2linkcount(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("linkcount", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable.linkcount", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
/* … */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_3linkcount, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_linkcount, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_linkcount, __pyx_t_1) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
  __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_linkcount, 72, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 72, __pyx_L1_error)
 073:         # For testing: how many objects are linked to this one?
+074:         return len(self._links)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->_links;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 74, __pyx_L1_error)
  }
  __pyx_t_2 = PySet_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 075: 
+076:     def ready(self):
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static int __pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_ready(CYTHON_UNUSED struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ready", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
    if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
    else {
      PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ready); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_5ready)) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_5;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
      tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
      if (unlikely(type_dict_guard != tp_dict_version)) {
        tp_dict_version = obj_dict_version = 0;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    }
    #endif
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("gevent.__abstract_linkable.AbstractLinkable.ready", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_4ready[] = "AbstractLinkable.ready(self) -> bool";
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_5ready = {"ready", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_5ready, METH_NOARGS, __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_4ready};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ready (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_4ready(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self));

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

static PyObject *__pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_4ready(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ready", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_ready(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __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.__abstract_linkable.AbstractLinkable.ready", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);
/* … */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_5ready, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_ready, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_ready, __pyx_t_1) < 0) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
  __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_ready, 76, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 76, __pyx_L1_error)
 077:         # Instances must define this
+078:         raise NotImplementedError
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 78, __pyx_L1_error)
 079: 
+080:     def _check_and_notify(self):
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__check_and_notify(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_check_and_notify", 0);
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._check_and_notify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 081:         # If this object is ready to be notified, begin the process.
+082:         if self.ready() and self._links and not self._notifier:
  __pyx_t_2 = (((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->_links != Py_None)&&(PySet_GET_SIZE(__pyx_v_self->_links) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {
/* … */
  }
+083:             if self.hub is None:
    __pyx_t_1 = (((PyObject *)__pyx_v_self->hub) == Py_None);
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {
/* … */
    }
+084:                 self.hub = get_hub()
      __pyx_t_4 = ((PyObject *)__pyx_f_6gevent_11__hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->hub);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->hub));
      __pyx_v_self->hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_4);
      __pyx_t_4 = 0;
 085: 
+086:             self._notifier = self.hub.loop.run_callback(self._notify_links)
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->_notifier);
    __Pyx_DECREF(__pyx_v_self->_notifier);
    __pyx_v_self->_notifier = __pyx_t_4;
    __pyx_t_4 = 0;
 087: 
+088:     def rawlink(self, callback):
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_rawlink(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rawlink", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
    if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
    else {
      PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rawlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_callback);
        __Pyx_XDECREF(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
      tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
      if (unlikely(type_dict_guard != tp_dict_version)) {
        tp_dict_version = obj_dict_version = 0;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    }
    #endif
  }
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable.rawlink", __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_19__abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
static char __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_6rawlink[] = "AbstractLinkable.rawlink(self, callback)\n\n        Register a callback to call when this object is ready.\n\n        *callback* will be called in the :class:`Hub\n        <gevent.hub.Hub>`, so it must not use blocking gevent API.\n        *callback* will be passed one argument: this instance.\n        ";
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink = {"rawlink", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink, METH_O, __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_6rawlink};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rawlink (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_6rawlink(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self), ((PyObject *)__pyx_v_callback));

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

static PyObject *__pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_6rawlink(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rawlink", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_rawlink(__pyx_v_self, __pyx_v_callback, 1); 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.__abstract_linkable.AbstractLinkable.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
/* … */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_7rawlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_rawlink, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_rawlink, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_rawlink, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 88, __pyx_L1_error)
 089:         """
 090:         Register a callback to call when this object is ready.
 091: 
 092:         *callback* will be called in the :class:`Hub
 093:         <gevent.hub.Hub>`, so it must not use blocking gevent API.
 094:         *callback* will be passed one argument: this instance.
 095:         """
+096:         if not callable(callback):
  __pyx_t_5 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 96, __pyx_L1_error)
  __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
  if (unlikely(__pyx_t_6)) {
/* … */
  }
+097:             raise TypeError('Expected callable: %r' % (callback, ))
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_callback);
    __Pyx_GIVEREF(__pyx_v_callback);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_callback);
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Expected_callable_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 97, __pyx_L1_error)
 098: 
+099:         self._links.add(callback)
  if (unlikely(__pyx_v_self->_links == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add");
    __PYX_ERR(0, 99, __pyx_L1_error)
  }
  __pyx_t_7 = PySet_Add(__pyx_v_self->_links, __pyx_v_callback); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 99, __pyx_L1_error)
+100:         self._check_and_notify()
  __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_check_and_notify(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 101: 
+102:     def unlink(self, callback):
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_unlink(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unlink", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
    if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
    else {
      PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_callback);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
      tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
      if (unlikely(type_dict_guard != tp_dict_version)) {
        tp_dict_version = obj_dict_version = 0;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    }
    #endif
  }
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable.unlink", __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_19__abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
static char __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_8unlink[] = "AbstractLinkable.unlink(self, callback)\nRemove the callback set by :meth:`rawlink`";
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink = {"unlink", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink, METH_O, __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_8unlink};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unlink (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_8unlink(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self), ((PyObject *)__pyx_v_callback));

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

static PyObject *__pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_8unlink(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unlink", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable_unlink(__pyx_v_self, __pyx_v_callback, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __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.__abstract_linkable.AbstractLinkable.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);
/* … */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_9unlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable_unlink, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_unlink, __pyx_t_1) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__abstract_linkable_py, __pyx_n_s_unlink, 102, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 102, __pyx_L1_error)
 103:         """Remove the callback set by :meth:`rawlink`"""
+104:         self._links.discard(callback)
  if (unlikely(__pyx_v_self->_links == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "discard");
    __PYX_ERR(0, 104, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PySet_Discard(__pyx_v_self->_links, __pyx_v_callback); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 104, __pyx_L1_error)
 105: 
+106:         if not self._links and self._notifier is not None:
  __pyx_t_7 = (__pyx_v_self->_links != Py_None)&&(PySet_GET_SIZE(__pyx_v_self->_links) != 0);
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = (__pyx_v_self->_notifier != Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_6) {
/* … */
  }
 107:             # If we currently have one queued, de-queue it.
 108:             # This will break a reference cycle.
 109:             # (self._notifier -> self._notify_links -> self)
 110:             # But we can't set it to None in case it was actually running.
+111:             self._notifier.stop()
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_notifier, __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 112: 
 113: 
+114:     def _notify_links(self):
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__notify_links(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_v_notifier = NULL;
  PyObject *__pyx_v_todo = NULL;
  PyObject *__pyx_v_link = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_notify_links", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;
    if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))))));
    else {
      PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links)) {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
      tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0;
      obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0;
      if (unlikely(type_dict_guard != tp_dict_version)) {
        tp_dict_version = obj_dict_version = 0;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP
    }
    #endif
  }
/* … */
  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_notifier);
  __Pyx_XDECREF(__pyx_v_todo);
  __Pyx_XDECREF(__pyx_v_link);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_10_notify_links[] = "AbstractLinkable._notify_links(self)";
static PyMethodDef __pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links = {"_notify_links", (PyCFunction)__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links, METH_NOARGS, __pyx_doc_6gevent_19__abstract_linkable_16AbstractLinkable_10_notify_links};
static PyObject *__pyx_pw_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_notify_links (wrapper)", 0);
  __pyx_r = __pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_10_notify_links(((struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self));

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

static PyObject *__pyx_pf_6gevent_19__abstract_linkable_16AbstractLinkable_10_notify_links(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_notify_links", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__notify_links(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __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.__abstract_linkable.AbstractLinkable._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
/* … */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_19__abstract_linkable_16AbstractLinkable_11_notify_links, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AbstractLinkable__notify_links, NULL, __pyx_n_s_gevent___abstract_linkable, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable->tp_dict, __pyx_n_s_notify_links, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_6gevent_19__abstract_linkable_AbstractLinkable);
 115:         # We release self._notifier here. We are called by it
 116:         # at the end of the loop, and it is now false in a boolean way (as soon
 117:         # as this method returns).
+118:         notifier = self._notifier
  __pyx_t_1 = __pyx_v_self->_notifier;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_notifier = __pyx_t_1;
  __pyx_t_1 = 0;
 119:         # We were ready() at the time this callback was scheduled;
 120:         # we may not be anymore, and that status may change during
 121:         # callback processing. Some of our subclasses will want to
 122:         # notify everyone that the status was once true, even though not it
 123:         # may not be anymore.
+124:         todo = set(self._links)
  __pyx_t_1 = PySet_New(__pyx_v_self->_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_todo = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+125:         try:
  /*try:*/ {
+126:             for link in todo:
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_set_iterator(__pyx_v_todo, 1, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_set_iter_next(__pyx_t_1, __pyx_t_6, &__pyx_t_5, &__pyx_t_2, __pyx_t_7);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 126, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_2);
      __pyx_t_2 = 0;
+127:                 if not self._notify_all and not self.ready():
      __pyx_t_10 = ((!(__pyx_v_self->_notify_all != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_9 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0)) != 0);
      __pyx_t_9 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_9) {
/* … */
      }
+128:                     break
        goto __pyx_L7_break;
 129: 
+130:                 if link not in self._links:
      if (unlikely(__pyx_v_self->_links == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 130, __pyx_L4_error)
      }
      __pyx_t_9 = (__Pyx_PySet_ContainsTF(__pyx_v_link, __pyx_v_self->_links, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 130, __pyx_L4_error)
      __pyx_t_10 = (__pyx_t_9 != 0);
      if (__pyx_t_10) {
/* … */
      }
 131:                     # Been removed already by some previous link. OK, fine.
+132:                     continue
        goto __pyx_L6_continue;
+133:                 try:
      /*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_L24_try_end;
          __pyx_L17_error:;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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);
          goto __pyx_L15_error;
          __pyx_L18_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_L24_try_end:;
        }
      }
+134:                     link(self)
            __Pyx_INCREF(__pyx_v_link);
            __pyx_t_3 = __pyx_v_link; __pyx_t_4 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_3, function);
              }
            }
            __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+135:                 except: # pylint:disable=bare-except
          /*except:*/ {
            __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 135, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GOTREF(__pyx_t_4);
 136:                     # We're running in the hub, so getcurrent() returns
 137:                     # a hub.
+138:                     self.hub.handle_error((link, self), *sys.exc_info()) # pylint:disable=undefined-variable
            __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->hub), __pyx_n_s_handle_error); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_14);
            __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_INCREF(__pyx_v_link);
            __Pyx_GIVEREF(__pyx_v_link);
            PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_link);
            __Pyx_INCREF(((PyObject *)__pyx_v_self));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
            PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_v_self));
            __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_16);
            __Pyx_GIVEREF(__pyx_t_15);
            PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
            __pyx_t_15 = 0;
            __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_sys); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_17);
            __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            __pyx_t_17 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
              __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
              if (likely(__pyx_t_17)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
                __Pyx_INCREF(__pyx_t_17);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_18, function);
              }
            }
            __pyx_t_15 = (__pyx_t_17) ? __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_17) : __Pyx_PyObject_CallNoArg(__pyx_t_18);
            __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
            if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            __pyx_t_18 = __Pyx_PySequence_Tuple(__pyx_t_15); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_t_15 = PyNumber_Add(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 138, __pyx_L19_except_error)
            __Pyx_GOTREF(__pyx_t_18);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 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;
            goto __pyx_L18_exception_handled;
          }
          __pyx_L19_except_error:;
 139:                 finally:
+140:                     if getattr(link, 'auto_unlink', None):
      /*finally:*/ {
        /*normal exit:*/{
          __pyx_t_4 = __Pyx_GetAttr3(__pyx_v_link, __pyx_n_s_auto_unlink, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 140, __pyx_L4_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_10) {
/* … */
          }
          goto __pyx_L16;
        }
        __pyx_L15_error:;
        /*exception exit:*/{
          __Pyx_PyThreadState_declare
          __Pyx_PyThreadState_assign
          __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 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;
          if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
          if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_12);
          __Pyx_XGOTREF(__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_21);
          __Pyx_XGOTREF(__pyx_t_22);
          __Pyx_XGOTREF(__pyx_t_23);
          __pyx_t_8 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename;
          {
            __pyx_t_4 = __Pyx_GetAttr3(__pyx_v_link, __pyx_n_s_auto_unlink, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L31_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 140, __pyx_L31_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (__pyx_t_10) {
/* … */
            }
          }
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          }
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_12);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ErrRestore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
          __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
          __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20;
          goto __pyx_L4_error;
          __pyx_L31_error:;
          if (PY_MAJOR_VERSION >= 3) {
            __Pyx_XGIVEREF(__pyx_t_21);
            __Pyx_XGIVEREF(__pyx_t_22);
            __Pyx_XGIVEREF(__pyx_t_23);
            __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
          goto __pyx_L4_error;
        }
        __pyx_L16:;
      }
      __pyx_L6_continue:;
    }
    __pyx_L7_break:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
 141:                         # This attribute can avoid having to keep a reference to the function
 142:                         # *in* the function, which is a cycle
+143:                         self.unlink(link)
            __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_link, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
/* … */
              __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_link, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L31_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 144:         finally:
 145:             # We should not have created a new notifier even if callbacks
 146:             # released us because we loop through *all* of our links on the
 147:             # same callback while self._notifier is still true.
+148:             assert self._notifier is notifier
  /*finally:*/ {
    /*normal exit:*/{
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_10 = (__pyx_v_self->_notifier == __pyx_v_notifier);
        if (unlikely(!(__pyx_t_10 != 0))) {
          PyErr_SetNone(PyExc_AssertionError);
          __PYX_ERR(0, 148, __pyx_L1_error)
        }
      }
      #endif
/* … */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_10 = (__pyx_v_self->_notifier == __pyx_v_notifier);
          if (unlikely(!(__pyx_t_10 != 0))) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 148, __pyx_L34_error)
          }
        }
        #endif
+149:             self._notifier = None
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_self->_notifier);
      __Pyx_DECREF(__pyx_v_self->_notifier);
      __pyx_v_self->_notifier = Py_None;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 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_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __pyx_t_7 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_24 = __pyx_filename;
      {
/* … */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->_notifier);
        __Pyx_DECREF(__pyx_v_self->_notifier);
        __pyx_v_self->_notifier = Py_None;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __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_23);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_ErrRestore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_24;
      goto __pyx_L1_error;
      __pyx_L34_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __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_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }
 150: 
 151:         # Our set of active links changed, and we were told to stop on the first
 152:         # time we went unready. See if we're ready, and if so, go around
 153:         # again.
+154:         if not self._notify_all and todo != self._links:
  __pyx_t_9 = ((!(__pyx_v_self->_notify_all != 0)) != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_10 = __pyx_t_9;
    goto __pyx_L36_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_todo, __pyx_v_self->_links, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __pyx_t_9;
  __pyx_L36_bool_binop_done:;
  if (__pyx_t_10) {
/* … */
  }
+155:             self._check_and_notify()
    __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_check_and_notify(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 156: 
+157:     def _wait_core(self, timeout, catch=Timeout):
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__wait_core(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, PyObject *__pyx_v_timeout, struct __pyx_opt_args_6gevent_19__abstract_linkable_16AbstractLinkable__wait_core *__pyx_optional_args) {
  PyObject *__pyx_v_catch = __pyx_k_;
  PyObject *__pyx_v_switch = NULL;
  PyObject *__pyx_v_timer = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_ex = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_wait_core", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_catch = __pyx_optional_args->catch;
    }
  }
/* … */
  /* 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_5);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_switch);
  __Pyx_XDECREF(__pyx_v_timer);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_ex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __Pyx_INCREF(__pyx_v_6gevent_19__abstract_linkable_Timeout);
  __pyx_k_ = __pyx_v_6gevent_19__abstract_linkable_Timeout;
  __Pyx_GIVEREF(__pyx_v_6gevent_19__abstract_linkable_Timeout);
 158:         # The core of the wait implementation, handling
 159:         # switching and linking. If *catch* is set to (),
 160:         # a timeout that elapses will be allowed to be raised.
 161:         # Returns a true value if the wait succeeded without timing out.
+162:         switch = getcurrent().switch # pylint:disable=undefined-variable
  __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_19__abstract_linkable_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_switch = __pyx_t_2;
  __pyx_t_2 = 0;
+163:         self.rawlink(switch)
  __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+164:         try:
  /*try:*/ {
+165:             with Timeout._start_new_or_dummy(timeout) as timer:
    /*with:*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_19__abstract_linkable_Timeout, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_timeout);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      /*try:*/ {
        {
          /*try:*/ {
            __pyx_v_timer = __pyx_t_3;
            __pyx_t_3 = 0;
/* … */
          }
          __pyx_L10_error:;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 165, __pyx_L12_except_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = PyTuple_Pack(3, __pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L12_except_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 165, __pyx_L12_except_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (__pyx_t_13 < 0) __PYX_ERR(0, 165, __pyx_L12_except_error)
            __pyx_t_12 = ((!(__pyx_t_13 != 0)) != 0);
            if (__pyx_t_12) {
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_XGIVEREF(__pyx_t_3);
              __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3);
              __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; 
              __PYX_ERR(0, 165, __pyx_L12_except_error)
            }
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            goto __pyx_L11_exception_handled;
          }
          __pyx_L12_except_error:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          goto __pyx_L4_error;
          __pyx_L14_try_return:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
          goto __pyx_L7_return;
          __pyx_L11_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_4) {
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__2, NULL);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 165, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
          goto __pyx_L9;
        }
        __pyx_L7_return: {
          __pyx_t_8 = __pyx_r;
          __pyx_r = 0;
          if (__pyx_t_4) {
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__2, NULL);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 165, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __pyx_r = __pyx_t_8;
          __pyx_t_8 = 0;
          goto __pyx_L3_return;
        }
        __pyx_L9:;
      }
      goto __pyx_L39;
      __pyx_L6_error:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_error;
      __pyx_L39:;
    }
  }
/* … */
  __pyx_tuple__2 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
+166:                 try:
            {
              /*try:*/ {
/* … */
              }
              __pyx_L16_error:;
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
/* … */
              __Pyx_XGIVEREF(__pyx_t_9);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
              goto __pyx_L10_error;
              __pyx_L20_try_return:;
              __Pyx_XGIVEREF(__pyx_t_9);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
              goto __pyx_L14_try_return;
              __pyx_L19_except_return:;
              __Pyx_XGIVEREF(__pyx_t_9);
              __Pyx_XGIVEREF(__pyx_t_10);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
              goto __pyx_L14_try_return;
            }
+167:                     if self.hub is None:
                __pyx_t_12 = (((PyObject *)__pyx_v_self->hub) == Py_None);
                __pyx_t_13 = (__pyx_t_12 != 0);
                if (__pyx_t_13) {
/* … */
                }
+168:                         self.hub = get_hub()
                  __pyx_t_3 = ((PyObject *)__pyx_f_6gevent_11__hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __Pyx_GIVEREF(__pyx_t_3);
                  __Pyx_GOTREF(__pyx_v_self->hub);
                  __Pyx_DECREF(((PyObject *)__pyx_v_self->hub));
                  __pyx_v_self->hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3);
                  __pyx_t_3 = 0;
+169:                     result = self.hub.switch()
                __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_self->hub->__pyx_vtab)->__pyx_switch(__pyx_v_self->hub, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L16_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_v_result = __pyx_t_3;
                __pyx_t_3 = 0;
+170:                     if result is not self: # pragma: no cover
                __pyx_t_13 = (__pyx_v_result != ((PyObject *)__pyx_v_self));
                __pyx_t_12 = (__pyx_t_13 != 0);
                if (unlikely(__pyx_t_12)) {
/* … */
                }
+171:                         raise InvalidSwitchError('Invalid switch into Event.wait(): %r' % (result, ))
                  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_2);
                  __Pyx_INCREF(__pyx_v_result);
                  __Pyx_GIVEREF(__pyx_v_result);
                  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_result);
                  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Event_wait_r, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __Pyx_INCREF(__pyx_v_6gevent_19__abstract_linkable_InvalidSwitchError);
                  __pyx_t_2 = __pyx_v_6gevent_19__abstract_linkable_InvalidSwitchError; __pyx_t_5 = NULL;
                  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
                    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
                    if (likely(__pyx_t_5)) {
                      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
                      __Pyx_INCREF(__pyx_t_5);
                      __Pyx_INCREF(function);
                      __Pyx_DECREF_SET(__pyx_t_2, function);
                    }
                  }
                  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
                  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_3);
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  __PYX_ERR(0, 171, __pyx_L16_error)
+172:                     return True
                __Pyx_XDECREF(__pyx_r);
                __Pyx_INCREF(Py_True);
                __pyx_r = Py_True;
                goto __pyx_L20_try_return;
+173:                 except catch as ex:
              __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(__pyx_v_catch);
              if (__pyx_t_14) {
                __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._wait_core", __pyx_clineno, __pyx_lineno, __pyx_filename);
                if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 173, __pyx_L18_except_error)
                __Pyx_GOTREF(__pyx_t_3);
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_GOTREF(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_2);
                __pyx_v_ex = __pyx_t_2;
                /*try:*/ {
/* … */
                /*finally:*/ {
                  __pyx_L29_error:;
                  /*exception exit:*/{
                    __Pyx_PyThreadState_declare
                    __Pyx_PyThreadState_assign
                    __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
                    if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
                    if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
                    __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_XGOTREF(__pyx_t_22);
                    __pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
                    {
                      __Pyx_DECREF(__pyx_v_ex);
                      __pyx_v_ex = NULL;
                    }
                    if (PY_MAJOR_VERSION >= 3) {
                      __Pyx_XGIVEREF(__pyx_t_20);
                      __Pyx_XGIVEREF(__pyx_t_21);
                      __Pyx_XGIVEREF(__pyx_t_22);
                      __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
                    }
                    __Pyx_XGIVEREF(__pyx_t_17);
                    __Pyx_XGIVEREF(__pyx_t_18);
                    __Pyx_XGIVEREF(__pyx_t_19);
                    __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19);
                    __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0;
                    __pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
                    goto __pyx_L18_except_error;
                  }
                  __pyx_L28_return: {
                    __pyx_t_22 = __pyx_r;
                    __pyx_r = 0;
                    __Pyx_DECREF(__pyx_v_ex);
                    __pyx_v_ex = NULL;
                    __pyx_r = __pyx_t_22;
                    __pyx_t_22 = 0;
                    goto __pyx_L19_except_return;
                  }
                }
              }
              goto __pyx_L18_except_error;
              __pyx_L18_except_error:;
+174:                     if ex is not timer:
                  __pyx_t_12 = (__pyx_v_ex != __pyx_v_timer);
                  __pyx_t_13 = (__pyx_t_12 != 0);
                  if (unlikely(__pyx_t_13)) {
/* … */
                  }
+175:                         raise
                    __Pyx_GIVEREF(__pyx_t_3);
                    __Pyx_GIVEREF(__pyx_t_2);
                    __Pyx_XGIVEREF(__pyx_t_1);
                    __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_1);
                    __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; 
                    __PYX_ERR(0, 175, __pyx_L29_error)
 176:                     # test_set_and_clear and test_timeout in test_threading
 177:                     # rely on the exact return values, not just truthish-ness
+178:                     return False
                  __Pyx_XDECREF(__pyx_r);
                  __Pyx_INCREF(Py_False);
                  __pyx_r = Py_False;
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                  goto __pyx_L28_return;
                }
 179:         finally:
+180:             self.unlink(switch)
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_6, &__pyx_t_11, &__pyx_t_10);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_8, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __pyx_t_15 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_23 = __pyx_filename;
      {
        __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L41_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_11, __pyx_t_10);
      }
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_8, __pyx_t_7);
      __pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      __pyx_lineno = __pyx_t_15; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_23;
      goto __pyx_L1_error;
      __pyx_L41_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_11, __pyx_t_10);
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_10 = __pyx_r;
      __pyx_r = 0;
      __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->unlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }
 181: 
+182:     def _wait_return_value(self, waited, wait_success):
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__wait_return_value(CYTHON_UNUSED struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_waited, CYTHON_UNUSED PyObject *__pyx_v_wait_success) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_wait_return_value", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 183:         # pylint:disable=unused-argument
 184:         # Subclasses should override this to return a value from _wait.
 185:         # By default we return None.
+186:         return None # pragma: no cover all extent subclasses override
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
 187: 
+188:     def _wait(self, timeout=None):
static PyObject *__pyx_f_6gevent_19__abstract_linkable_16AbstractLinkable__wait(struct __pyx_obj_6gevent_19__abstract_linkable_AbstractLinkable *__pyx_v_self, struct __pyx_opt_args_6gevent_19__abstract_linkable_16AbstractLinkable__wait *__pyx_optional_args) {
  PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
  PyObject *__pyx_v_gotit = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_wait", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_timeout = __pyx_optional_args->timeout;
    }
  }
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("gevent.__abstract_linkable.AbstractLinkable._wait", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gotit);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+189:         if self.ready():
  __pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0);
  if (__pyx_t_1) {
/* … */
  }
+190:             return self._wait_return_value(False, False)
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_return_value(__pyx_v_self, Py_False, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
 191: 
+192:         gotit = self._wait_core(timeout)
  __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_core(__pyx_v_self, __pyx_v_timeout, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gotit = __pyx_t_2;
  __pyx_t_2 = 0;
+193:         return self._wait_return_value(True, gotit)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_19__abstract_linkable_AbstractLinkable *)__pyx_v_self->__pyx_vtab)->_wait_return_value(__pyx_v_self, Py_True, __pyx_v_gotit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 194: 
+195: def _init():
static void __pyx_f_6gevent_19__abstract_linkable__init(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_init", 0);
/* … */
  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
+196:     greenlet_init() # pylint:disable=undefined-variable
  __pyx_f_6gevent_19__abstract_linkable_greenlet_init();
 197: 
+198: _init()
  __pyx_f_6gevent_19__abstract_linkable__init();
 199: 
 200: 
+201: from gevent._util import import_c_accel
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_import_c_accel);
  __Pyx_GIVEREF(__pyx_n_s_import_c_accel);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_import_c_accel);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_1) < 0) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+202: import_c_accel(globals(), 'gevent.__abstract_linkable')
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_gevent___abstract_linkable);
  __Pyx_GIVEREF(__pyx_n_s_gevent___abstract_linkable);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_gevent___abstract_linkable);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;