Generated by Cython 3.1.2

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

Raw output: _greenlet_primitives.c

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

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

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

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

     004: """

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

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

     007:

     008: """

     009: from __future__ import absolute_import

     010: from __future__ import division

     011: from __future__ import print_function

     012:

    +013: from weakref import ref as wref

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_ref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_weakref, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref);
      __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +014: from gc import get_objects

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_get_objects); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gc, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_get_objects); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects);
      __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     015:

    +016: from greenlet import greenlet

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_greenlet); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_greenlet, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     017:

    +018: from gevent.exceptions import BlockingSwitchOutError

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

     019:

     020:

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

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

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

     024: # error.

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

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

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

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

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

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

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

    +027: locals()['_greenlet_switch'] = greenlet.switch

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet), __pyx_mstate_global->__pyx_n_u_switch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely((PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_greenlet_switch, __pyx_t_4) < 0))) __PYX_ERR(0, 27, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     028:

     029:

    +030: __all__ = [

      __pyx_t_4 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_TrackedRawGreenlet, __pyx_mstate_global->__pyx_n_u_SwitchOutGreenletWithLoop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_4) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     031:     'TrackedRawGreenlet',

     032:     'SwitchOutGreenletWithLoop',

     033: ]

     034:

     035: class TrackedRawGreenlet(greenlet):

     036:

    +037:     def __init__(self, function, parent):

    /* Python wrapper */
    static int __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_function = 0;
      PyObject *__pyx_v_parent = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_function,&__pyx_mstate_global->__pyx_n_u_parent,0};
      PyObject* values[2] = {0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 37, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 37, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 37, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 37, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 37, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 37, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 37, __pyx_L3_error)
        }
        __pyx_v_function = values[0];
        __pyx_v_parent = values[1];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 37, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet___init__(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_TrackedRawGreenlet *)__pyx_v_self), __pyx_v_function, __pyx_v_parent);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static int __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet___init__(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_TrackedRawGreenlet *__pyx_v_self, PyObject *__pyx_v_function, PyObject *__pyx_v_parent) {
      PyGreenlet *__pyx_v_current = NULL;
      int __pyx_r;
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_current);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +038:         greenlet.__init__(self, function, parent)

      __pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_function, __pyx_v_parent};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     039:         # See greenlet.py's Greenlet class. We capture the cheap

     040:         # parts to maintain the tree structure, but we do not capture

     041:         # the stack because that's too expensive for 'spawn_raw'.

     042:

    +043:         current = getcurrent() # pylint:disable=undefined-variable

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_29_gevent_c_greenlet_primitives_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_current = ((PyGreenlet *)__pyx_t_1);
      __pyx_t_1 = 0;

    +044:         self.spawning_greenlet = wref(current)

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref);
      __pyx_t_4 = __pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref;
      __pyx_t_3 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_3 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_current)};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_spawning_greenlet, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     045:         # See Greenlet for how trees are maintained.

    +046:         try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* … */
        __pyx_L5_except_error:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L4_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
        __pyx_L8_try_end:;
      }

    +047:             self.spawn_tree_locals = current.spawn_tree_locals

          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_current), __pyx_mstate_global->__pyx_n_u_spawn_tree_locals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_spawn_tree_locals, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L3_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +048:         except AttributeError:

        __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
        if (__pyx_t_8) {
          __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L5_except_error)
          __Pyx_XGOTREF(__pyx_t_1);
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_2);

    +049:             self.spawn_tree_locals = {}

          __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 49, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_spawn_tree_locals, __pyx_t_9) < 0) __PYX_ERR(0, 49, __pyx_L5_except_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    +050:             if current.parent:

          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_current), __pyx_mstate_global->__pyx_n_u_parent); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 50, __pyx_L5_except_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10) {
    /* … */
          }
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L4_exception_handled;
        }
        goto __pyx_L5_except_error;

    +051:                 current.spawn_tree_locals = self.spawn_tree_locals

            __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_spawn_tree_locals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 51, __pyx_L5_except_error)
            __Pyx_GOTREF(__pyx_t_9);
            if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_current), __pyx_mstate_global->__pyx_n_u_spawn_tree_locals, __pyx_t_9) < 0) __PYX_ERR(0, 51, __pyx_L5_except_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

     052:

     053:

    +054: class SwitchOutGreenletWithLoop(TrackedRawGreenlet):

    struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop {
      PyObject *(*__pyx_switch)(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *, int __pyx_skip_dispatch);
      PyObject *(*switch_out)(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *, int __pyx_skip_dispatch);
    };
    static struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_vtabptr_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop;

     055:     # Subclasses must define:

     056:     # - self.loop

     057:

     058:     # This class defines loop in its .pxd for Cython. This lets us avoid

     059:     # circular dependencies with the hub.

     060:

    +061:     def switch(self):

    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_v_switch_out = NULL;
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_switch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_switch_out);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch, "SwitchOutGreenletWithLoop.switch(self)");
    static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch = {"switch", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch};
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("switch (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SwitchOutGreenletWithLoop_switch, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_greenlet_primit, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop, __pyx_mstate_global->__pyx_n_u_switch, __pyx_t_4) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +062:         switch_out = getattr(getcurrent(), 'switch_out', None) # pylint:disable=undefined-variable

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_29_gevent_c_greenlet_primitives_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetAttr3(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_switch_out, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_switch_out = __pyx_t_2;
      __pyx_t_2 = 0;

    +063:         if switch_out is not None:

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

    +064:             switch_out()

        __pyx_t_1 = NULL;
        __Pyx_INCREF(__pyx_v_switch_out);
        __pyx_t_4 = __pyx_v_switch_out;
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_1);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +065:         return _greenlet_switch(self) # pylint:disable=undefined-variable

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives__greenlet_switch(((PyGreenlet *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     066:

    +067:     def switch_out(self):

    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch_out(CYTHON_UNUSED struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self, int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      /* Check if called by wrapper */
      if (unlikely(__pyx_skip_dispatch)) ;
      /* Check if overridden in Python */
      else if (
      #if !CYTHON_USE_TYPE_SLOTS
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop &&
      __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
      #else
      unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
      #endif
      ) {
        #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
        if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
          PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_switch_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out)) {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_3 = NULL;
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_4 = __pyx_t_1;
            __pyx_t_5 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_3);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_5 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
            }
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            goto __pyx_L0;
          }
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
          __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
          if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
            __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
          }
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
        }
        #endif
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch_out", __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_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out, "SwitchOutGreenletWithLoop.switch_out(self)");
    static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out = {"switch_out", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out};
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("switch_out (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch_out(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch_out", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SwitchOutGreenletWithLoop_switch_2, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_greenlet_primit, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop, __pyx_mstate_global->__pyx_n_u_switch_out, __pyx_t_4) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +068:         raise BlockingSwitchOutError('Impossible to call blocking function in the event loop callback')

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

     069:

     070:

    +071: def get_reachable_greenlets():

    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_7genexpr__pyx_v_x = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_reachable_greenlets", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets, "get_reachable_greenlets() -> list");
    static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets = {"get_reachable_greenlets", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets};
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("get_reachable_greenlets (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(__pyx_self);

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

    static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_reachable_greenlets", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets, 0, __pyx_mstate_global->__pyx_n_u_get_reachable_greenlets, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_greenlet_primit, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_reachable_greenlets, __pyx_t_4) < 0) __PYX_ERR(0, 71, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     072:     # We compile this loop with Cython so that it's faster, and so that

     073:     # the GIL isn't dropped at unpredictable times during the loop.

     074:     # Dropping the GIL could lead to accessing partly constructed objects

     075:     # in undefined states (particularly, tuples). This helps close a hole

     076:     # where a `SystemError: Objects/tupleobject.c bad argument to internal function`

     077:     # could get raised. (Note that this probably doesn't completely close the hole,

     078:     # if other threads have dropped the GIL, but hopefully the speed makes that

     079:     # more rare.) See https://github.com/gevent/gevent/issues/1302

    +080:     return [

      __Pyx_XDECREF(__pyx_r);
      { /* enter inner scope */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_1);

    +081:         x for x in get_objects()

        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects);
        __pyx_t_4 = __pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects;
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
          __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
          __pyx_t_6 = 0;
          __pyx_t_7 = NULL;
        } else {
          __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L5_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        for (;;) {
          if (likely(!__pyx_t_7)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 81, __pyx_L5_error)
                #endif
                if (__pyx_t_6 >= __pyx_temp) break;
              }
              __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_6);
              ++__pyx_t_6;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 81, __pyx_L5_error)
                #endif
                if (__pyx_t_6 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6));
              #else
              __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_6);
              #endif
              ++__pyx_t_6;
            }
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L5_error)
          } else {
            __pyx_t_2 = __pyx_t_7(__pyx_t_4);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 81, __pyx_L5_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_2);
          __pyx_t_2 = 0;
    /* … */
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_x))) __PYX_ERR(0, 80, __pyx_L5_error)
    /* … */
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
        goto __pyx_L12_exit_scope;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;
        goto __pyx_L1_error;
        __pyx_L12_exit_scope:;
      } /* exit inner scope */
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

    +082:         if isinstance(x, greenlet) and not getattr(x, 'greenlet_tree_is_ignored', False)

          __pyx_t_9 = __Pyx_TypeCheck(__pyx_7genexpr__pyx_v_x, __pyx_mstate_global->__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet);
          if (__pyx_t_9) {
          } else {
            __pyx_t_8 = __pyx_t_9;
            goto __pyx_L9_bool_binop_done;
          }
          __pyx_t_2 = __Pyx_GetAttr3(__pyx_7genexpr__pyx_v_x, __pyx_mstate_global->__pyx_n_u_greenlet_tree_is_ignored, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 82, __pyx_L5_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_10 = (!__pyx_t_9);
          __pyx_t_8 = __pyx_t_10;
          __pyx_L9_bool_binop_done:;
          if (__pyx_t_8) {
    /* … */
          }

     083:     ]

     084:

     085: # Cache the global memoryview so cython can optimize.

    +086: _memoryview = memoryview

      __Pyx_INCREF((PyObject *)(&PyMemoryView_Type));
      __Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);
      __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview, (&PyMemoryView_Type));
      __Pyx_GIVEREF((PyObject *)(&PyMemoryView_Type));

    +087: try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_try_end;
        __pyx_L2_error:;
        __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_L4_except_error:;
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_6, __pyx_t_7);
        goto __pyx_L1_error;
        __pyx_L3_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_6, __pyx_t_7);
        __pyx_L7_try_end:;
      }

    +088:     if isinstance(__builtins__, dict):

          __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_builtins); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_8 = PyDict_Check(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_8) {
    /* … */
            goto __pyx_L8;
          }

     089:         # Pure-python mode on CPython

    +090:         _buffer = __builtins__['buffer']

            __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_builtins); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L2_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_buffer_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L2_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (!(likely(PyType_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_2))) __PYX_ERR(0, 90, __pyx_L2_error)
            __Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);
            __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, ((PyTypeObject*)__pyx_t_2));
            __Pyx_GIVEREF(__pyx_t_2);
            __pyx_t_2 = 0;

     091:     else:

     092:         # Cythonized mode, or PyPy

    +093:         _buffer = __builtins__.buffer

          /*else*/ {
            __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_builtins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L2_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_buffer_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L2_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (!(likely(PyType_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_4))) __PYX_ERR(0, 93, __pyx_L2_error)
            __Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);
            __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, ((PyTypeObject*)__pyx_t_4));
            __Pyx_GIVEREF(__pyx_t_4);
            __pyx_t_4 = 0;
          }
          __pyx_L8:;

    +094: except (AttributeError, KeyError):

        __pyx_t_9 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_AttributeError, __pyx_builtin_KeyError);
        if (__pyx_t_9) {
          __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 94, __pyx_L4_except_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_2);
          __Pyx_XGOTREF(__pyx_t_3);

     095:     # Python 3.

    +096:     _buffer = memoryview

          __Pyx_INCREF((PyObject *)(&PyMemoryView_Type));
          __Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);
          __Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, (&PyMemoryView_Type));
          __Pyx_GIVEREF((PyObject *)(&PyMemoryView_Type));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L3_exception_handled;
        }
        goto __pyx_L4_except_error;

     097:

    +098: def get_memory(data):

    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
    static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_memory(PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_mv = NULL;
      PyObject *__pyx_r = NULL;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_mv);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_2get_memory, "get_memory(data)");
    static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_3get_memory = {"get_memory", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory, METH_O, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_2get_memory};
    static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("get_memory (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_2get_memory(__pyx_self, ((PyObject *)__pyx_v_data));

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

    static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_2get_memory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data) {
      PyObject *__pyx_r = NULL;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_memory(__pyx_v_data, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_3get_memory, 0, __pyx_mstate_global->__pyx_n_u_get_memory, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_greenlet_primit, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_memory, __pyx_t_3) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     099:     # On Python 2, memoryview(memoryview()) can leak in some cases,

     100:     # notably when an io.BufferedWriter object produced the memoryview.

     101:     # So we need to check to see if we already have one before we convert.

     102:     # We do this in Cython to mitigate the performance cost (which turns out to be a

     103:     # net win.)

     104:

     105:     # We don't specifically test for this leak.

     106:

     107:     # https://github.com/gevent/gevent/issues/1318

    +108:     try:

      {
        /*try:*/ {
    /* … */
        }
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    /* … */
        __pyx_L5_except_error:;
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
        goto __pyx_L1_error;
        __pyx_L7_try_return:;
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
        goto __pyx_L0;
        __pyx_L6_except_return:;
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
        goto __pyx_L0;
      }

    +109:         mv = _memoryview(data) if not isinstance(data, _memoryview) else data

          __pyx_t_5 = ((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_7 = (!__pyx_t_6);
          if (__pyx_t_7) {
            __pyx_t_8 = NULL;
            __Pyx_INCREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);
            __pyx_t_9 = ((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);
            __pyx_t_10 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_data};
              __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L3_error)
              __Pyx_GOTREF(__pyx_t_5);
            }
            __pyx_t_4 = __pyx_t_5;
            __pyx_t_5 = 0;
          } else {
            __Pyx_INCREF(__pyx_v_data);
            __pyx_t_4 = __pyx_v_data;
          }
          __pyx_v_mv = __pyx_t_4;
          __pyx_t_4 = 0;

    +110:         if mv.shape:

          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_mstate_global->__pyx_n_u_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 110, __pyx_L3_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_7) {
    /* … */
          }

    +111:             return mv

            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_v_mv);
            __pyx_r = __pyx_v_mv;
            goto __pyx_L7_try_return;

     112:         # No shape, probably working with a ctypes object,

     113:         # or something else exotic that supports the buffer interface

    +114:         return mv.tobytes()

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_5 = __pyx_v_mv;
          __Pyx_INCREF(__pyx_t_5);
          __pyx_t_10 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
            __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tobytes, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L3_error)
            __Pyx_GOTREF(__pyx_t_4);
          }
          __pyx_r = __pyx_t_4;
          __pyx_t_4 = 0;
          goto __pyx_L7_try_return;

    +115:     except TypeError:

        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 115, __pyx_L5_except_error)
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_9);

     116:         # fixes "python2.7 array.array doesn't support memoryview used in

     117:         # gevent.socket.send" issue

     118:         # (http://code.google.com/p/gevent/issues/detail?id=94)

    +119:         if _buffer is _memoryview:

          __pyx_t_7 = (__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer == __pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);
          if (unlikely(__pyx_t_7)) {
    /* … */
          }

     120:             # Py3

    +121:             raise

            __Pyx_GIVEREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_5);
            __Pyx_XGIVEREF(__pyx_t_9);
            __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_5, __pyx_t_9);
            __pyx_t_4 = 0;  __pyx_t_5 = 0;  __pyx_t_9 = 0;
            __PYX_ERR(0, 121, __pyx_L5_except_error)

    +122:         return _buffer(data)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_12 = NULL;
          __Pyx_INCREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);
          __pyx_t_13 = ((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);
          __pyx_t_10 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_data};
            __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L5_except_error)
            __Pyx_GOTREF(__pyx_t_8);
          }
          __pyx_r = __pyx_t_8;
          __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L6_except_return;
        }
        goto __pyx_L5_except_error;

     123:

     124:

     125:

    +126: def _init():

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

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

    static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_4_init(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
    /* … */
      __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_5_init, 0, __pyx_mstate_global->__pyx_n_u_init_2, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_c_greenlet_primit, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_init_2, __pyx_t_3) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

      __pyx_f_6gevent_29_gevent_c_greenlet_primitives_greenlet_init(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L1_error)

     128:

    +129: _init()

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

     130:

    +131: from gevent._util import import_c_accel

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

    +132: import_c_accel(globals(), 'gevent.__greenlet_primitives')

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