Cython: local.py

Generated by Cython 3.0a1

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: local.c

    +001: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False

        __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 CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_1);
        if (PyModule_AddObject(__pyx_m, __pyx_k_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
        #else
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     002: """

     003: Greenlet-local objects.

     004:

     005: This module is based on `_threading_local.py`__ from the standard

     006: library of Python 3.4.

     007:

     008: __ https://github.com/python/cpython/blob/3.4/Lib/_threading_local.py

     009:

     010: Greenlet-local objects support the management of greenlet-local data.

     011: If you have data that you want to be local to a greenlet, simply create

     012: a greenlet-local object and use its attributes:

     013:

     014:   >>> mydata = local()

     015:   >>> mydata.number = 42

     016:   >>> mydata.number

     017:   42

     018:

     019: You can also access the local-object's dictionary:

     020:

     021:   >>> mydata.__dict__

     022:   {'number': 42}

     023:   >>> mydata.__dict__.setdefault('widgets', [])

     024:   []

     025:   >>> mydata.widgets

     026:   []

     027:

     028: What's important about greenlet-local objects is that their data are

     029: local to a greenlet. If we access the data in a different greenlet:

     030:

     031:   >>> log = []

     032:   >>> def f():

     033:   ...     items = list(mydata.__dict__.items())

     034:   ...     items.sort()

     035:   ...     log.append(items)

     036:   ...     mydata.number = 11

     037:   ...     log.append(mydata.number)

     038:   >>> greenlet = gevent.spawn(f)

     039:   >>> greenlet.join()

     040:   >>> log

     041:   [[], 11]

     042:

     043: we get different data.  Furthermore, changes made in the other greenlet

     044: don't affect data seen in this greenlet:

     045:

     046:   >>> mydata.number

     047:   42

     048:

     049: Of course, values you get from a local object, including a __dict__

     050: attribute, are for whatever greenlet was current at the time the

     051: attribute was read.  For that reason, you generally don't want to save

     052: these values across greenlets, as they apply only to the greenlet they

     053: came from.

     054:

     055: You can create custom local objects by subclassing the local class:

     056:

     057:   >>> class MyLocal(local):

     058:   ...     number = 2

     059:   ...     initialized = False

     060:   ...     def __init__(self, **kw):

     061:   ...         if self.initialized:

     062:   ...             raise SystemError('__init__ called too many times')

     063:   ...         self.initialized = True

     064:   ...         self.__dict__.update(kw)

     065:   ...     def squared(self):

     066:   ...         return self.number ** 2

     067:

     068: This can be useful to support default values, methods and

     069: initialization.  Note that if you define an __init__ method, it will be

     070: called each time the local object is used in a separate greenlet.  This

     071: is necessary to initialize each greenlet's dictionary.

     072:

     073: Now if we create a local object:

     074:

     075:   >>> mydata = MyLocal(color='red')

     076:

     077: Now we have a default number:

     078:

     079:   >>> mydata.number

     080:   2

     081:

     082: an initial color:

     083:

     084:   >>> mydata.color

     085:   'red'

     086:   >>> del mydata.color

     087:

     088: And a method that operates on the data:

     089:

     090:   >>> mydata.squared()

     091:   4

     092:

     093: As before, we can access the data in a separate greenlet:

     094:

     095:   >>> log = []

     096:   >>> greenlet = gevent.spawn(f)

     097:   >>> greenlet.join()

     098:   >>> log

     099:   [[('color', 'red'), ('initialized', True)], 11]

     100:

     101: without affecting this greenlet's data:

     102:

     103:   >>> mydata.number

     104:   2

     105:   >>> mydata.color

     106:   Traceback (most recent call last):

     107:   ...

     108:   AttributeError: 'MyLocal' object has no attribute 'color'

     109:

     110: Note that subclasses can define slots, but they are not greenlet

     111: local. They are shared across greenlets::

     112:

     113:   >>> class MyLocal(local):

     114:   ...     __slots__ = 'number'

     115:

     116:   >>> mydata = MyLocal()

     117:   >>> mydata.number = 42

     118:   >>> mydata.color = 'red'

     119:

     120: So, the separate greenlet:

     121:

     122:   >>> greenlet = gevent.spawn(f)

     123:   >>> greenlet.join()

     124:

     125: affects what we see:

     126:

     127:   >>> mydata.number

     128:   11

     129:

     130: >>> del mydata

     131:

     132: .. versionchanged:: 1.1a2

     133:    Update the implementation to match Python 3.4 instead of Python 2.5.

     134:    This results in locals being eligible for garbage collection as soon

     135:    as their greenlet exits.

     136:

     137: .. versionchanged:: 1.2.3

     138:    Use a weak-reference to clear the greenlet link we establish in case

     139:    the local object dies before the greenlet does.

     140:

     141: .. versionchanged:: 1.3a1

     142:    Implement the methods for attribute access directly, handling

     143:    descriptors directly here. This allows removing the use of a lock

     144:    and facilitates greatly improved performance.

     145:

     146: .. versionchanged:: 1.3a1

     147:    The ``__init__`` method of subclasses of ``local`` is no longer

     148:    called with a lock held. CPython does not use such a lock in its

     149:    native implementation. This could potentially show as a difference

     150:    if code that uses multiple dependent attributes in ``__slots__``

     151:    (which are shared across all greenlets) switches during ``__init__``.

     152:

     153: """

     154: from __future__ import print_function

     155:

    +156: from copy import copy

        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_n_s_copy_2);
        __Pyx_GIVEREF(__pyx_n_s_copy_2);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_copy_2);
        __pyx_t_2 = __Pyx_Import(__pyx_n_s_copy_2, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __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_copy_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_v_6gevent_6_local_copy);
        __Pyx_DECREF_SET(__pyx_v_6gevent_6_local_copy, __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;

    +157: from weakref import ref

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_ref);
        __Pyx_GIVEREF(__pyx_n_s_ref);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ref);
        __pyx_t_1 = __Pyx_Import(__pyx_n_s_weakref, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __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_ref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_v_6gevent_6_local_ref);
        __Pyx_DECREF_SET(__pyx_v_6gevent_6_local_ref, __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;

     158:

     159:

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

        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_getcurrent, __pyx_t_2) < 0)) __PYX_ERR(0, 160, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple_);
      __Pyx_GIVEREF(__pyx_tuple_);

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

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

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

    static PyObject *__pyx_lambda_funcdef_6gevent_6_local_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;
    }
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_4lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__local, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        #else
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_4lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__local, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
        #endif
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_greenlet_init, __pyx_t_2) < 0)) __PYX_ERR(0, 161, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     162:

    +163: __all__ = [

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_local);
        __Pyx_GIVEREF(__pyx_n_s_local);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_local);
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_2);
        if (PyModule_AddObject(__pyx_m, __pyx_k_all, __pyx_t_2) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
        #else
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     164:     "local",

     165: ]

     166:

     167: # The key used in the Thread objects' attribute dicts.

     168: # We keep it a string for speed but make it unlikely to clash with

     169: # a "real" attribute.

    +170: key_prefix = '_gevent_local_localimpl_'

        __Pyx_INCREF(__pyx_n_s_gevent_local_localimpl);
        __Pyx_XGOTREF(__pyx_v_6gevent_6_local_key_prefix);
        __Pyx_DECREF_SET(__pyx_v_6gevent_6_local_key_prefix, __pyx_n_s_gevent_local_localimpl);
        __Pyx_GIVEREF(__pyx_n_s_gevent_local_localimpl);

     171:

     172: # The overall structure is as follows:

     173: # For each local() object:

     174: # greenlet.__dict__[key_prefix + str(id(local))]

     175: #    => _localimpl.dicts[id(greenlet)] => (ref(greenlet), {})

     176:

     177: # That final tuple is actually a localimpl_dict_entry object.

     178:

    +179: def all_local_dicts_for_greenlet(greenlet):

    static PyObject *__pyx_pw_6gevent_6_local_1all_local_dicts_for_greenlet(PyObject *__pyx_self, PyObject *__pyx_v_greenlet); /*proto*/
    static PyObject *__pyx_f_6gevent_6_local_all_local_dicts_for_greenlet(PyGreenlet *__pyx_v_greenlet, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_result = 0;
      struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_local_impl = 0;
      struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *__pyx_v_entry = 0;
      PyObject *__pyx_v_k = 0;
      PyObject *__pyx_v_greenlet_dict = 0;
      PyObject *__pyx_v_id_greenlet = NULL;
      PyObject *__pyx_v_v = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("all_local_dicts_for_greenlet", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_AddTraceback("gevent._local.all_local_dicts_for_greenlet", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XDECREF((PyObject *)__pyx_v_local_impl);
      __Pyx_XDECREF((PyObject *)__pyx_v_entry);
      __Pyx_XDECREF(__pyx_v_k);
      __Pyx_XDECREF(__pyx_v_greenlet_dict);
      __Pyx_XDECREF(__pyx_v_id_greenlet);
      __Pyx_XDECREF(__pyx_v_v);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_1all_local_dicts_for_greenlet(PyObject *__pyx_self, PyObject *__pyx_v_greenlet); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_6_local_all_local_dicts_for_greenlet, "all_local_dicts_for_greenlet(greenlet greenlet)\n\n    Internal debug helper for getting the local values associated\n    with a greenlet. This is subject to change or removal at any time.\n\n    :return: A list of ((type, id), {}) pairs, where the first element\n      is the type and id of the local object and the second object is its\n      instance dictionary, as seen from this greenlet.\n\n    .. versionadded:: 1.3a2\n    ");
    static PyMethodDef __pyx_mdef_6gevent_6_local_1all_local_dicts_for_greenlet = {"all_local_dicts_for_greenlet", (PyCFunction)__pyx_pw_6gevent_6_local_1all_local_dicts_for_greenlet, METH_O, __pyx_doc_6gevent_6_local_all_local_dicts_for_greenlet};
    static PyObject *__pyx_pw_6gevent_6_local_1all_local_dicts_for_greenlet(PyObject *__pyx_self, PyObject *__pyx_v_greenlet) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("all_local_dicts_for_greenlet (wrapper)", 0);
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_greenlet), __pyx_ptype_6gevent_6_local_greenlet, 1, "greenlet", 0))) __PYX_ERR(0, 179, __pyx_L1_error)
      __pyx_r = __pyx_pf_6gevent_6_local_all_local_dicts_for_greenlet(__pyx_self, ((PyGreenlet *)__pyx_v_greenlet));

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6gevent_6_local_all_local_dicts_for_greenlet(CYTHON_UNUSED PyObject *__pyx_self, PyGreenlet *__pyx_v_greenlet) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("all_local_dicts_for_greenlet", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_6gevent_6_local_all_local_dicts_for_greenlet(__pyx_v_greenlet, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __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._local.all_local_dicts_for_greenlet", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 179, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__2);
      __Pyx_GIVEREF(__pyx_tuple__2);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_1all_local_dicts_for_greenlet, 0, __pyx_n_s_all_local_dicts_for_greenlet, NULL, __pyx_n_s_gevent__local, __pyx_t_1, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        #else
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_1all_local_dicts_for_greenlet, 0, __pyx_n_s_all_local_dicts_for_greenlet, NULL, __pyx_n_s_gevent__local, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
        #endif
        __Pyx_GOTREF(__pyx_t_2);
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_2);
        if (PyModule_AddObject(__pyx_m, __pyx_k_all_local_dicts_for_greenlet, __pyx_t_2) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
        #else
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_all_local_dicts_for_greenlet, __pyx_t_2) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_local_py, __pyx_n_s_all_local_dicts_for_greenlet, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 179, __pyx_L1_error)

     180:     """

     181:     Internal debug helper for getting the local values associated

     182:     with a greenlet. This is subject to change or removal at any time.

     183:

     184:     :return: A list of ((type, id), {}) pairs, where the first element

     185:       is the type and id of the local object and the second object is its

     186:       instance dictionary, as seen from this greenlet.

     187:

     188:     .. versionadded:: 1.3a2

     189:     """

     190:

    +191:     result = []

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

    +192:     id_greenlet = id(greenlet)

      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_greenlet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_id_greenlet = __pyx_t_1;
      __pyx_t_1 = 0;

    +193:     greenlet_dict = greenlet.__dict__

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_greenlet), __pyx_n_s_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", __Pyx_PyType_Name(Py_TYPE(__pyx_t_1))), 0))) __PYX_ERR(0, 193, __pyx_L1_error)
      __pyx_v_greenlet_dict = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +194:     for k, v in greenlet_dict.items():

      __pyx_t_2 = 0;
      if (unlikely(__pyx_v_greenlet_dict == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
        __PYX_ERR(0, 194, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_greenlet_dict, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
      while (1) {
        __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
        if (unlikely(__pyx_t_7 == 0)) break;
        if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 194, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", __Pyx_PyType_Name(Py_TYPE(__pyx_t_5))), 0))) __PYX_ERR(0, 194, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_k, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;
        __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
        __pyx_t_6 = 0;

    +195:         if not k.startswith(key_prefix):

        if (unlikely(__pyx_v_k == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "startswith");
          __PYX_ERR(0, 195, __pyx_L1_error)
        }
        __pyx_t_8 = __Pyx_PyStr_Tailmatch(__pyx_v_k, __pyx_v_6gevent_6_local_key_prefix, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error)
        __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
        if (__pyx_t_9) {
    /* … */
        }

    +196:             continue

          goto __pyx_L3_continue;

    +197:         local_impl = v()

        __Pyx_INCREF(__pyx_v_v);
        __pyx_t_5 = __pyx_v_v; __pyx_t_10 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_7 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[1] = {__pyx_t_10, };
          __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6gevent_6_local__localimpl))))) __PYX_ERR(0, 197, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_local_impl, ((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_t_6));
        __pyx_t_6 = 0;

    +198:         if local_impl is None:

        __pyx_t_9 = (((PyObject *)__pyx_v_local_impl) == Py_None);
        __pyx_t_8 = (__pyx_t_9 != 0);
        if (__pyx_t_8) {
    /* … */
        }

    +199:             continue

          goto __pyx_L3_continue;

    +200:         entry = local_impl.dicts.get(id_greenlet)

        if (unlikely(__pyx_v_local_impl->dicts == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
          __PYX_ERR(0, 200, __pyx_L1_error)
        }
        __pyx_t_6 = __Pyx_PyDict_GetItemDefault(__pyx_v_local_impl->dicts, __pyx_v_id_greenlet, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6gevent_6_local__localimpl_dict_entry))))) __PYX_ERR(0, 200, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *)__pyx_t_6));
        __pyx_t_6 = 0;

    +201:         if entry is None:

        __pyx_t_8 = (((PyObject *)__pyx_v_entry) == Py_None);
        __pyx_t_9 = (__pyx_t_8 != 0);
        if (__pyx_t_9) {
    /* … */
        }

     202:             # Not yet used in this greenlet.

    +203:             continue

          goto __pyx_L3_continue;

    +204:         assert entry.wrgreenlet() is greenlet

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __Pyx_INCREF(__pyx_v_entry->wrgreenlet);
          __pyx_t_5 = __pyx_v_entry->wrgreenlet; __pyx_t_10 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
              __pyx_t_11 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[1] = {__pyx_t_10, };
            __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_11, 0+__pyx_t_11);
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __pyx_t_9 = (__pyx_t_6 == ((PyObject *)__pyx_v_greenlet));
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!(__pyx_t_9 != 0))) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 204, __pyx_L1_error)
          }
        }
        #endif

    +205:         result.append((local_impl.localtypeid, entry.localdict))

        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_local_impl->localtypeid);
        __Pyx_GIVEREF(__pyx_v_local_impl->localtypeid);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_local_impl->localtypeid);
        __Pyx_INCREF(__pyx_v_entry->localdict);
        __Pyx_GIVEREF(__pyx_v_entry->localdict);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_entry->localdict);
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 205, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_L3_continue:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     206:

    +207:     return result

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

     208:

     209:

     210: class _wrefdict(dict):

     211:     """A dict that can be weak referenced"""

     212:

     213: class _greenlet_deleted(object):

     214:     """

     215:     A weakref callback for when the greenlet

     216:     is deleted.

     217:

     218:     If the greenlet is a `gevent.greenlet.Greenlet` and

     219:     supplies ``rawlink``, that will be used instead of a

     220:     weakref.

     221:     """

    +222:     __slots__ = ('idt', 'wrdicts')

        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_tuple__4);
        if (PyModule_AddObject(__pyx_m, __pyx_k_slots, __pyx_tuple__4) < 0) __PYX_ERR(0, 222, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local__greenlet_deleted->tp_dict, __pyx_n_s_slots, __pyx_tuple__4) < 0) __PYX_ERR(0, 222, __pyx_L1_error)
        #endif
        PyType_Modified(__pyx_ptype_6gevent_6_local__greenlet_deleted);
    /* … */
      __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_idt, __pyx_n_s_wrdicts); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 222, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__4);
      __Pyx_GIVEREF(__pyx_tuple__4);

     223:

    +224:     def __init__(self, idt, wrdicts):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_17_greenlet_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_6_local_17_greenlet_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_idt = 0;
      PyObject *__pyx_v_wrdicts = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idt,&__pyx_n_s_wrdicts,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idt,&__pyx_n_s_wrdicts,0};
        #endif
        PyObject* values[2] = {0,0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idt)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wrdicts)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 224, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 224, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
          values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        }
        __pyx_v_idt = values[0];
        __pyx_v_wrdicts = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 224, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._greenlet_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_17_greenlet_deleted___init__(((struct __pyx_obj_6gevent_6_local__greenlet_deleted *)__pyx_v_self), __pyx_v_idt, __pyx_v_wrdicts);

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

    static int __pyx_pf_6gevent_6_local_17_greenlet_deleted___init__(struct __pyx_obj_6gevent_6_local__greenlet_deleted *__pyx_v_self, PyObject *__pyx_v_idt, PyObject *__pyx_v_wrdicts) {
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +225:         self.idt = idt

      __Pyx_INCREF(__pyx_v_idt);
      __Pyx_GIVEREF(__pyx_v_idt);
      __Pyx_GOTREF(__pyx_v_self->idt);
      __Pyx_DECREF(__pyx_v_self->idt);
      __pyx_v_self->idt = __pyx_v_idt;

    +226:         self.wrdicts = wrdicts

      __Pyx_INCREF(__pyx_v_wrdicts);
      __Pyx_GIVEREF(__pyx_v_wrdicts);
      __Pyx_GOTREF(__pyx_v_self->wrdicts);
      __Pyx_DECREF(__pyx_v_self->wrdicts);
      __pyx_v_self->wrdicts = __pyx_v_wrdicts;

     227:

    +228:     def __call__(self, _unused):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_17_greenlet_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_pw_6gevent_6_local_17_greenlet_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      CYTHON_UNUSED PyObject *__pyx_v__unused = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unused,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unused,0};
        #endif
        PyObject* values[1] = {0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_unused)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 228, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(0, 228, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        }
        __pyx_v__unused = values[0];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 228, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._greenlet_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_17_greenlet_deleted_2__call__(((struct __pyx_obj_6gevent_6_local__greenlet_deleted *)__pyx_v_self), __pyx_v__unused);

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

    static PyObject *__pyx_pf_6gevent_6_local_17_greenlet_deleted_2__call__(struct __pyx_obj_6gevent_6_local__greenlet_deleted *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__unused) {
      PyObject *__pyx_v_dicts = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__call__", 0);
    /* … */
      /* 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_AddTraceback("gevent._local._greenlet_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dicts);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +229:         dicts = self.wrdicts()

      __Pyx_INCREF(__pyx_v_self->wrdicts);
      __pyx_t_2 = __pyx_v_self->wrdicts; __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      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_4 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[1] = {__pyx_t_3, };
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_dicts = __pyx_t_1;
      __pyx_t_1 = 0;

    +230:         if dicts:

      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_dicts); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
      }

    +231:             dicts.pop(self.idt, None)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dicts, __pyx_n_s_pop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        __pyx_t_6 = 0;
        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_6 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_self->idt, Py_None};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __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;

     232:

     233: class _local_deleted(object):

    +234:     __slots__ = ('key', 'wrthread', 'greenlet_deleted')

        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_tuple__5);
        if (PyModule_AddObject(__pyx_m, __pyx_k_slots, __pyx_tuple__5) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local__local_deleted->tp_dict, __pyx_n_s_slots, __pyx_tuple__5) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
        #endif
        PyType_Modified(__pyx_ptype_6gevent_6_local__local_deleted);
    /* … */
      __pyx_tuple__5 = PyTuple_Pack(3, __pyx_n_s_key, __pyx_n_s_wrthread, __pyx_n_s_greenlet_deleted); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__5);
      __Pyx_GIVEREF(__pyx_tuple__5);

     235:

    +236:     def __init__(self, key, wrthread, greenlet_deleted):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_14_local_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_6_local_14_local_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_key = 0;
      PyObject *__pyx_v_wrthread = 0;
      PyObject *__pyx_v_greenlet_deleted = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_wrthread,&__pyx_n_s_greenlet_deleted,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_wrthread,&__pyx_n_s_greenlet_deleted,0};
        #endif
        PyObject* values[3] = {0,0,0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_key)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wrthread)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 236, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_greenlet_deleted)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 236, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 236, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
          values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
          values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
        }
        __pyx_v_key = values[0];
        __pyx_v_wrthread = values[1];
        __pyx_v_greenlet_deleted = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 236, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._local_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_14_local_deleted___init__(((struct __pyx_obj_6gevent_6_local__local_deleted *)__pyx_v_self), __pyx_v_key, __pyx_v_wrthread, __pyx_v_greenlet_deleted);

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

    static int __pyx_pf_6gevent_6_local_14_local_deleted___init__(struct __pyx_obj_6gevent_6_local__local_deleted *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_wrthread, PyObject *__pyx_v_greenlet_deleted) {
      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._local._local_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +237:         self.key = key

      if (!(likely(PyString_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", __Pyx_PyType_Name(Py_TYPE(__pyx_v_key))), 0))) __PYX_ERR(0, 237, __pyx_L1_error)
      __pyx_t_1 = __pyx_v_key;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->key);
      __Pyx_DECREF(__pyx_v_self->key);
      __pyx_v_self->key = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +238:         self.wrthread = wrthread

      __Pyx_INCREF(__pyx_v_wrthread);
      __Pyx_GIVEREF(__pyx_v_wrthread);
      __Pyx_GOTREF(__pyx_v_self->wrthread);
      __Pyx_DECREF(__pyx_v_self->wrthread);
      __pyx_v_self->wrthread = __pyx_v_wrthread;

    +239:         self.greenlet_deleted = greenlet_deleted

      if (!(likely(((__pyx_v_greenlet_deleted) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_greenlet_deleted, __pyx_ptype_6gevent_6_local__greenlet_deleted))))) __PYX_ERR(0, 239, __pyx_L1_error)
      __pyx_t_1 = __pyx_v_greenlet_deleted;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->greenlet_deleted);
      __Pyx_DECREF((PyObject *)__pyx_v_self->greenlet_deleted);
      __pyx_v_self->greenlet_deleted = ((struct __pyx_obj_6gevent_6_local__greenlet_deleted *)__pyx_t_1);
      __pyx_t_1 = 0;

     240:

    +241:     def __call__(self, _unused):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_14_local_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_pw_6gevent_6_local_14_local_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      CYTHON_UNUSED PyObject *__pyx_v__unused = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unused,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unused,0};
        #endif
        PyObject* values[1] = {0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_unused)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(0, 241, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
        }
        __pyx_v__unused = values[0];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 241, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._local_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_14_local_deleted_2__call__(((struct __pyx_obj_6gevent_6_local__local_deleted *)__pyx_v_self), __pyx_v__unused);

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

    static PyObject *__pyx_pf_6gevent_6_local_14_local_deleted_2__call__(struct __pyx_obj_6gevent_6_local__local_deleted *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__unused) {
      PyObject *__pyx_v_thread = NULL;
      PyObject *__pyx_v_unlink = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__call__", 0);
    /* … */
      /* 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_AddTraceback("gevent._local._local_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_thread);
      __Pyx_XDECREF(__pyx_v_unlink);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +242:         thread = self.wrthread()

      __Pyx_INCREF(__pyx_v_self->wrthread);
      __pyx_t_2 = __pyx_v_self->wrthread; __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      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_4 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[1] = {__pyx_t_3, };
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_thread = __pyx_t_1;
      __pyx_t_1 = 0;

    +243:         if thread is not None:

      __pyx_t_5 = (__pyx_v_thread != Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {
    /* … */
      }

    +244:             try:

        {
          /*try:*/ {
    /* … */
          }
    /* … */
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          goto __pyx_L1_error;
          __pyx_L5_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          __pyx_L9_try_end:;
        }

    +245:                 unlink = thread.unlink

            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread, __pyx_n_s_unlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_v_unlink = __pyx_t_1;
            __pyx_t_1 = 0;

    +246:             except AttributeError:

          __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
          if (__pyx_t_11) {
            __Pyx_ErrRestore(0,0,0);
            goto __pyx_L5_exception_handled;
          }
          goto __pyx_L6_except_error;
          __pyx_L6_except_error:;

     247:                 pass

     248:             else:

    +249:                 unlink(self.greenlet_deleted)

          /*else:*/ {
            __Pyx_INCREF(__pyx_v_unlink);
            __pyx_t_2 = __pyx_v_unlink; __pyx_t_3 = NULL;
            __pyx_t_10 = 0;
            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_10 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self->greenlet_deleted)};
              __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L6_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L9_try_end;
          __pyx_L4_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;

    +250:             del thread.__dict__[self.key]

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread, __pyx_n_s_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(PyObject_DelItem(__pyx_t_1, __pyx_v_self->key) < 0)) __PYX_ERR(0, 250, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     251:

     252: class _localimpl(object):

     253:     """A class managing thread-local dicts"""

    +254:     __slots__ = ('key', 'dicts',

        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_tuple__6);
        if (PyModule_AddObject(__pyx_m, __pyx_k_slots, __pyx_tuple__6) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local__localimpl->tp_dict, __pyx_n_s_slots, __pyx_tuple__6) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
        #endif
        PyType_Modified(__pyx_ptype_6gevent_6_local__localimpl);
    /* … */
      __pyx_tuple__6 = PyTuple_Pack(6, __pyx_n_s_key, __pyx_n_s_dicts, __pyx_n_s_localargs, __pyx_n_s_localkwargs, __pyx_n_s_localtypeid, __pyx_n_s_weakref_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__6);
      __Pyx_GIVEREF(__pyx_tuple__6);

     255:                  'localargs', 'localkwargs',

     256:                  'localtypeid',

     257:                  '__weakref__',)

     258:

    +259:     def __init__(self, args, kwargs, local_type, id_local):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_10_localimpl_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_6_local_10_localimpl_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_args = 0;
      PyObject *__pyx_v_kwargs = 0;
      PyObject *__pyx_v_local_type = 0;
      PyObject *__pyx_v_id_local = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_local_type,&__pyx_n_s_id_local,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_local_type,&__pyx_n_s_id_local,0};
        #endif
        PyObject* values[4] = {0,0,0,0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_args)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 259, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_local_type)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 259, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_id_local)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 259, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 259, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 4)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
          values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
          values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
          values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
        }
        __pyx_v_args = values[0];
        __pyx_v_kwargs = values[1];
        __pyx_v_local_type = values[2];
        __pyx_v_id_local = values[3];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 259, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._localimpl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_10_localimpl___init__(((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, __pyx_v_local_type, __pyx_v_id_local);

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

    static int __pyx_pf_6gevent_6_local_10_localimpl___init__(struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, PyObject *__pyx_v_local_type, PyObject *__pyx_v_id_local) {
      PyGreenlet *__pyx_v_greenlet = NULL;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("gevent._local._localimpl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_greenlet);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +260:         self.key = key_prefix + str(id(self))

      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_Str(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_v_6gevent_6_local_key_prefix, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", __Pyx_PyType_Name(Py_TYPE(__pyx_t_1))), 0))) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->key);
      __Pyx_DECREF(__pyx_v_self->key);
      __pyx_v_self->key = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     261:         # { id(greenlet) -> _localimpl_dict_entry(ref(greenlet), greenlet-local dict) }

    +262:         self.dicts = _wrefdict()

      __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_6_local__wrefdict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->dicts);
      __Pyx_DECREF(__pyx_v_self->dicts);
      __pyx_v_self->dicts = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +263:         self.localargs = args

      if (!(likely(PyTuple_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", __Pyx_PyType_Name(Py_TYPE(__pyx_v_args))), 0))) __PYX_ERR(0, 263, __pyx_L1_error)
      __pyx_t_1 = __pyx_v_args;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->localargs);
      __Pyx_DECREF(__pyx_v_self->localargs);
      __pyx_v_self->localargs = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +264:         self.localkwargs = kwargs

      if (!(likely(PyDict_CheckExact(__pyx_v_kwargs))||((__pyx_v_kwargs) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", __Pyx_PyType_Name(Py_TYPE(__pyx_v_kwargs))), 0))) __PYX_ERR(0, 264, __pyx_L1_error)
      __pyx_t_1 = __pyx_v_kwargs;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->localkwargs);
      __Pyx_DECREF(__pyx_v_self->localkwargs);
      __pyx_v_self->localkwargs = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +265:         self.localtypeid = local_type, id_local

      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_local_type);
      __Pyx_GIVEREF(__pyx_v_local_type);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_local_type);
      __Pyx_INCREF(__pyx_v_id_local);
      __Pyx_GIVEREF(__pyx_v_id_local);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_id_local);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->localtypeid);
      __Pyx_DECREF(__pyx_v_self->localtypeid);
      __pyx_v_self->localtypeid = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     266:

     267:         # We need to create the thread dict in anticipation of

     268:         # __init__ being called, to make sure we don't call it

     269:         # again ourselves. MUST do this before setting any attributes.

    +270:         greenlet = getcurrent() # pylint:disable=undefined-variable

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_6_local_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_greenlet = ((PyGreenlet *)__pyx_t_1);
      __pyx_t_1 = 0;

    +271:         _localimpl_create_dict(self, greenlet, id(greenlet))

      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_greenlet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_f_6gevent_6_local__localimpl_create_dict(__pyx_v_self, __pyx_v_greenlet, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     272:

     273: class _localimpl_dict_entry(object):

     274:     """

     275:     The object that goes in the ``dicts`` of ``_localimpl``

     276:     object for each thread.

     277:     """

     278:     # This is a class, not just a tuple, so that cython can optimize

     279:     # attribute access

    +280:     __slots__ = ('wrgreenlet', 'localdict')

        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_tuple__7);
        if (PyModule_AddObject(__pyx_m, __pyx_k_slots, __pyx_tuple__7) < 0) __PYX_ERR(0, 280, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local__localimpl_dict_entry->tp_dict, __pyx_n_s_slots, __pyx_tuple__7) < 0) __PYX_ERR(0, 280, __pyx_L1_error)
        #endif
        PyType_Modified(__pyx_ptype_6gevent_6_local__localimpl_dict_entry);
    /* … */
      __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_wrgreenlet, __pyx_n_s_localdict); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__7);
      __Pyx_GIVEREF(__pyx_tuple__7);

     281:

    +282:     def __init__(self, wrgreenlet, localdict):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_21_localimpl_dict_entry_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_6_local_21_localimpl_dict_entry_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_wrgreenlet = 0;
      PyObject *__pyx_v_localdict = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wrgreenlet,&__pyx_n_s_localdict,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wrgreenlet,&__pyx_n_s_localdict,0};
        #endif
        PyObject* values[2] = {0,0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            case  2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wrgreenlet)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_localdict)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 282, __pyx_L3_error)
            else {
              __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 282, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 282, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
          values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
        }
        __pyx_v_wrgreenlet = values[0];
        __pyx_v_localdict = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 282, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("gevent._local._localimpl_dict_entry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_21_localimpl_dict_entry___init__(((struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *)__pyx_v_self), __pyx_v_wrgreenlet, __pyx_v_localdict);

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

    static int __pyx_pf_6gevent_6_local_21_localimpl_dict_entry___init__(struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *__pyx_v_self, PyObject *__pyx_v_wrgreenlet, PyObject *__pyx_v_localdict) {
      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._local._localimpl_dict_entry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +283:         self.wrgreenlet = wrgreenlet

      __Pyx_INCREF(__pyx_v_wrgreenlet);
      __Pyx_GIVEREF(__pyx_v_wrgreenlet);
      __Pyx_GOTREF(__pyx_v_self->wrgreenlet);
      __Pyx_DECREF(__pyx_v_self->wrgreenlet);
      __pyx_v_self->wrgreenlet = __pyx_v_wrgreenlet;

    +284:         self.localdict = localdict

      if (!(likely(PyDict_CheckExact(__pyx_v_localdict))||((__pyx_v_localdict) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", __Pyx_PyType_Name(Py_TYPE(__pyx_v_localdict))), 0))) __PYX_ERR(0, 284, __pyx_L1_error)
      __pyx_t_1 = __pyx_v_localdict;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->localdict);
      __Pyx_DECREF(__pyx_v_self->localdict);
      __pyx_v_self->localdict = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     285:

     286: # We use functions instead of methods so that they can be cdef'd in

     287: # local.pxd; if they were cdef'd as methods, they would cause

     288: # the creation of a pointer and a vtable. This happens

     289: # even if we declare the class @cython.final. functions thus save memory overhead

     290: # (but not pointer chasing overhead; the vtable isn't used when we declare

     291: # the class final).

     292:

     293:

    +294: def _localimpl_create_dict(self, greenlet, id_greenlet):

    static PyObject *__pyx_f_6gevent_6_local__localimpl_create_dict(struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_self, PyGreenlet *__pyx_v_greenlet, PyObject *__pyx_v_id_greenlet) {
      PyObject *__pyx_v_localdict = 0;
      PyObject *__pyx_v_key = 0;
      struct __pyx_obj_6gevent_6_local__greenlet_deleted *__pyx_v_greenlet_deleted = 0;
      struct __pyx_obj_6gevent_6_local__local_deleted *__pyx_v_local_deleted = 0;
      PyObject *__pyx_v_wrdicts = NULL;
      PyObject *__pyx_v_rawlink = NULL;
      PyObject *__pyx_v_wrthread = NULL;
      PyObject *__pyx_v_wrlocal = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_localimpl_create_dict", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("gevent._local._localimpl_create_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_localdict);
      __Pyx_XDECREF(__pyx_v_key);
      __Pyx_XDECREF((PyObject *)__pyx_v_greenlet_deleted);
      __Pyx_XDECREF((PyObject *)__pyx_v_local_deleted);
      __Pyx_XDECREF(__pyx_v_wrdicts);
      __Pyx_XDECREF(__pyx_v_rawlink);
      __Pyx_XDECREF(__pyx_v_wrthread);
      __Pyx_XDECREF(__pyx_v_wrlocal);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     295:     """Create a new dict for the current thread, and return it."""

    +296:     localdict = {}

      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_localdict = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +297:     key = self.key

      __pyx_t_1 = __pyx_v_self->key;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_key = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     298:

    +299:     wrdicts = ref(self.dicts)

      __Pyx_INCREF(__pyx_v_6gevent_6_local_ref);
      __pyx_t_2 = __pyx_v_6gevent_6_local_ref; __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_4 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_self->dicts};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_wrdicts = __pyx_t_1;
      __pyx_t_1 = 0;

     300:

     301:     # When the greenlet is deleted, remove the local dict.

     302:     # Note that this is suboptimal if the greenlet object gets

     303:     # caught in a reference loop. We would like to be called

     304:     # as soon as the OS-level greenlet ends instead.

     305:

     306:     # If we are working with a gevent.greenlet.Greenlet, we

     307:     # can pro-actively clear out with a link, avoiding the

     308:     # issue described above. Use rawlink to avoid spawning any

     309:     # more greenlets.

    +310:     greenlet_deleted = _greenlet_deleted(id_greenlet, wrdicts)

      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_id_greenlet);
      __Pyx_GIVEREF(__pyx_v_id_greenlet);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_id_greenlet);
      __Pyx_INCREF(__pyx_v_wrdicts);
      __Pyx_GIVEREF(__pyx_v_wrdicts);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_wrdicts);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_local__greenlet_deleted), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_greenlet_deleted = ((struct __pyx_obj_6gevent_6_local__greenlet_deleted *)__pyx_t_2);
      __pyx_t_2 = 0;

     311:

    +312:     rawlink = getattr(greenlet, 'rawlink', None)

      __pyx_t_2 = __Pyx_GetAttr3(((PyObject *)__pyx_v_greenlet), __pyx_n_s_rawlink, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_rawlink = __pyx_t_2;
      __pyx_t_2 = 0;

    +313:     if rawlink is not None:

      __pyx_t_5 = (__pyx_v_rawlink != Py_None);
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {
    /* … */
        goto __pyx_L3;
      }

    +314:         rawlink(greenlet_deleted)

        __Pyx_INCREF(__pyx_v_rawlink);
        __pyx_t_1 = __pyx_v_rawlink; __pyx_t_3 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(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_7 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_greenlet_deleted)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +315:         wrthread = ref(greenlet)

        __Pyx_INCREF(__pyx_v_6gevent_6_local_ref);
        __pyx_t_1 = __pyx_v_6gevent_6_local_ref; __pyx_t_3 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_greenlet)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __pyx_v_wrthread = __pyx_t_2;
        __pyx_t_2 = 0;

     316:     else:

    +317:         wrthread = ref(greenlet, greenlet_deleted)

      /*else*/ {
        __Pyx_INCREF(__pyx_v_6gevent_6_local_ref);
        __pyx_t_1 = __pyx_v_6gevent_6_local_ref; __pyx_t_3 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(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_9 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_greenlet), ((PyObject *)__pyx_v_greenlet_deleted)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __pyx_v_wrthread = __pyx_t_2;
        __pyx_t_2 = 0;
      }
      __pyx_L3:;

     318:

     319:

     320:     # When the localimpl is deleted, remove the thread attribute.

    +321:     local_deleted = _local_deleted(key, wrthread, greenlet_deleted)

      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
      __Pyx_INCREF(__pyx_v_wrthread);
      __Pyx_GIVEREF(__pyx_v_wrthread);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_wrthread);
      __Pyx_INCREF((PyObject *)__pyx_v_greenlet_deleted);
      __Pyx_GIVEREF((PyObject *)__pyx_v_greenlet_deleted);
      PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_greenlet_deleted));
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_local__local_deleted), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_local_deleted = ((struct __pyx_obj_6gevent_6_local__local_deleted *)__pyx_t_1);
      __pyx_t_1 = 0;

     322:

     323:

    +324:     wrlocal = ref(self, local_deleted)

      __Pyx_INCREF(__pyx_v_6gevent_6_local_ref);
      __pyx_t_2 = __pyx_v_6gevent_6_local_ref; __pyx_t_3 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_10 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_local_deleted)};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_wrlocal = __pyx_t_1;
      __pyx_t_1 = 0;

    +325:     greenlet.__dict__[key] = wrlocal

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_greenlet), __pyx_n_s_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_key, __pyx_v_wrlocal) < 0)) __PYX_ERR(0, 325, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     326:

    +327:     self.dicts[id_greenlet] = _localimpl_dict_entry(wrthread, localdict)

      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_wrthread);
      __Pyx_GIVEREF(__pyx_v_wrthread);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_wrthread);
      __Pyx_INCREF(__pyx_v_localdict);
      __Pyx_GIVEREF(__pyx_v_localdict);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_localdict);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_local__localimpl_dict_entry), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_self->dicts == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 327, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_self->dicts, __pyx_v_id_greenlet, __pyx_t_2) < 0)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +328:     return localdict

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

     329:

     330:

    +331: _marker = object()

        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XGOTREF(__pyx_v_6gevent_6_local__marker);
        __Pyx_DECREF_SET(__pyx_v_6gevent_6_local__marker, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;

     332:

    +333: def _local_get_dict(self):

    static CYTHON_INLINE PyObject *__pyx_f_6gevent_6_local__local_get_dict(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self) {
      struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_impl = 0;
      PyObject *__pyx_v_dct = 0;
      struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *__pyx_v_entry = 0;
      PyGreenlet *__pyx_v_greenlet = NULL;
      PyObject *__pyx_v_idg = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_local_get_dict", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_AddTraceback("gevent._local._local_get_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_impl);
      __Pyx_XDECREF(__pyx_v_dct);
      __Pyx_XDECREF((PyObject *)__pyx_v_entry);
      __Pyx_XDECREF((PyObject *)__pyx_v_greenlet);
      __Pyx_XDECREF(__pyx_v_idg);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +334:     impl = self._local__impl

      __pyx_t_1 = ((PyObject *)__pyx_v_self->_local__impl);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_impl = ((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_t_1);
      __pyx_t_1 = 0;

     335:     # Cython can optimize dict[], but not dict.get()

    +336:     greenlet = getcurrent() # pylint:disable=undefined-variable

      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_6_local_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_greenlet = ((PyGreenlet *)__pyx_t_1);
      __pyx_t_1 = 0;

    +337:     idg = id(greenlet)

      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_greenlet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_idg = __pyx_t_1;
      __pyx_t_1 = 0;

    +338:     try:

      {
        /*try:*/ {
    /* … */
        }
        __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_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
        goto __pyx_L1_error;
        __pyx_L4_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
        __pyx_L8_try_end:;
      }

    +339:         entry = impl.dicts[idg]

          if (unlikely(__pyx_v_impl->dicts == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 339, __pyx_L3_error)
          }
          __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_impl->dicts, __pyx_v_idg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_6_local__localimpl_dict_entry))))) __PYX_ERR(0, 339, __pyx_L3_error)
          __pyx_v_entry = ((struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *)__pyx_t_1);
          __pyx_t_1 = 0;

    +340:         dct = entry.localdict

          __pyx_t_1 = __pyx_v_entry->localdict;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_v_dct = ((PyObject*)__pyx_t_1);
          __pyx_t_1 = 0;

    +341:     except KeyError:

        __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_5) {
          __Pyx_AddTraceback("gevent._local._local_get_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 341, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

    +342:         dct = _localimpl_create_dict(impl, greenlet, idg)

          __pyx_t_8 = __pyx_f_6gevent_6_local__localimpl_create_dict(__pyx_v_impl, __pyx_v_greenlet, __pyx_v_idg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_XDECREF_SET(__pyx_v_dct, ((PyObject*)__pyx_t_8));
          __pyx_t_8 = 0;

    +343:         self.__init__(*impl.localargs, **impl.localkwargs)

          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (unlikely(__pyx_v_impl->localargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 343, __pyx_L5_except_error)
          }
          if (unlikely(__pyx_v_impl->localkwargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 343, __pyx_L5_except_error)
          }
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_v_impl->localargs, __pyx_v_impl->localkwargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 343, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __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_L4_exception_handled;
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

    +344:     return dct

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

     345:

    +346: def _init():

    static void __pyx_f_6gevent_6_local__init(void) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_init", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

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

      __pyx_f_6gevent_6_local_greenlet_init();

     348:

     349: _local_attrs = {

    +350:     '_local__impl',

        __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local__impl) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_get_descriptors) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_set_or_del_descripto) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_del_descriptors) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_set_descriptors) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_2) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_vars) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_class) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_cinit) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_v_6gevent_6_local__local_attrs);
        __Pyx_DECREF_SET(__pyx_v_6gevent_6_local__local_attrs, ((PyObject*)__pyx_t_2));
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;

     351:     '_local_type_get_descriptors',

     352:     '_local_type_set_or_del_descriptors',

     353:     '_local_type_del_descriptors',

     354:     '_local_type_set_descriptors',

     355:     '_local_type',

     356:     '_local_type_vars',

     357:     '__class__',

     358:     '__cinit__',

     359: }

     360:

    +361: class local(object):

    struct __pyx_vtabstruct_6gevent_6_local_local {
      struct __pyx_obj_6gevent_6_local_local *(*__pyx___copy__)(struct __pyx_obj_6gevent_6_local_local *, int __pyx_skip_dispatch);
    };
    static struct __pyx_vtabstruct_6gevent_6_local_local *__pyx_vtabptr_6gevent_6_local_local;

     362:     """

     363:     An object whose attributes are greenlet-local.

     364:     """

    +365:     __slots__ = tuple(_local_attrs - {'__class__', '__cinit__'})

        __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PySet_Add(__pyx_t_2, __pyx_n_s_class) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
        if (PySet_Add(__pyx_t_2, __pyx_n_s_cinit) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
        __pyx_t_1 = PyNumber_Subtract(__pyx_v_6gevent_6_local__local_attrs, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_2);
        if (PyModule_AddObject(__pyx_m, __pyx_k_slots, __pyx_t_2) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local_local->tp_dict, __pyx_n_s_slots, __pyx_t_2) < 0) __PYX_ERR(0, 365, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_6_local_local);

     366:

    +367:     def __cinit__(self, *args, **kw):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_5local_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_6gevent_6_local_5local_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_args = 0;
      PyObject *__pyx_v_kw = 0;
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
      if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
      if (unlikely(__pyx_kwds)) {
        __pyx_v_kw = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
        if (unlikely(!__pyx_v_kw)) return -1;
        __Pyx_GOTREF(__pyx_v_kw);
      } else {
        __pyx_v_kw = PyDict_New();
        if (unlikely(!__pyx_v_kw)) return -1;
        __Pyx_GOTREF(__pyx_v_kw);
      }
      __Pyx_INCREF(__pyx_args);
      __pyx_v_args = __pyx_args;
      __pyx_r = __pyx_pf_6gevent_6_local_5local___cinit__(((struct __pyx_obj_6gevent_6_local_local *)__pyx_v_self), __pyx_v_args, __pyx_v_kw);

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

    static int __pyx_pf_6gevent_6_local_5local___cinit__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kw) {
      struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_impl = NULL;
      PyObject *__pyx_v_get = NULL;
      PyObject *__pyx_v_dels = NULL;
      PyObject *__pyx_v_sets_or_dels = NULL;
      PyObject *__pyx_v_sets = NULL;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__cinit__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("gevent._local.local.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_impl);
      __Pyx_XDECREF(__pyx_v_get);
      __Pyx_XDECREF(__pyx_v_dels);
      __Pyx_XDECREF(__pyx_v_sets_or_dels);
      __Pyx_XDECREF(__pyx_v_sets);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +368:         if args or kw:

      __pyx_t_2 = (PyTuple_GET_SIZE(__pyx_v_args) != 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_kw); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 368, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_1) {
    /* … */
      }

    +369:             if type(self).__init__ == object.__init__:

        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(__pyx_t_1)) {
    /* … */
        }

    +370:                 raise TypeError("Initialization arguments are not supported", args, kw)

          __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_kp_s_Initialization_arguments_are_not);
          __Pyx_GIVEREF(__pyx_kp_s_Initialization_arguments_are_not);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_s_Initialization_arguments_are_not);
          __Pyx_INCREF(__pyx_v_args);
          __Pyx_GIVEREF(__pyx_v_args);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_args);
          __Pyx_INCREF(__pyx_v_kw);
          __Pyx_GIVEREF(__pyx_v_kw);
          PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_kw);
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_Raise(__pyx_t_4, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __PYX_ERR(0, 370, __pyx_L1_error)

    +371:         impl = _localimpl(args, kw, type(self), id(self))

      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_args);
      __Pyx_GIVEREF(__pyx_v_args);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_args);
      __Pyx_INCREF(__pyx_v_kw);
      __Pyx_GIVEREF(__pyx_v_kw);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_kw);
      __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_local__localimpl), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_impl = ((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_t_4);
      __pyx_t_4 = 0;

     372:         # pylint:disable=attribute-defined-outside-init

    +373:         self._local__impl = impl

      __Pyx_INCREF((PyObject *)__pyx_v_impl);
      __Pyx_GIVEREF((PyObject *)__pyx_v_impl);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_local__impl);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_local__impl);
      __pyx_v_self->_local__impl = __pyx_v_impl;

    +374:         get, dels, sets_or_dels, sets = _local_find_descriptors(self)

      __pyx_t_4 = __pyx_f_6gevent_6_local__local_find_descriptors(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(__pyx_t_4 != Py_None)) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 374, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2);
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_6,&__pyx_t_7};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 374, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 374, __pyx_L1_error)
      }
      __pyx_v_get = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_dels = __pyx_t_3;
      __pyx_t_3 = 0;
      __pyx_v_sets_or_dels = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_sets = __pyx_t_7;
      __pyx_t_7 = 0;

    +375:         self._local_type_get_descriptors = get

      if (!(likely(PySet_CheckExact(__pyx_v_get))||((__pyx_v_get) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", __Pyx_PyType_Name(Py_TYPE(__pyx_v_get))), 0))) __PYX_ERR(0, 375, __pyx_L1_error)
      __pyx_t_4 = __pyx_v_get;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_local_type_get_descriptors);
      __Pyx_DECREF(__pyx_v_self->_local_type_get_descriptors);
      __pyx_v_self->_local_type_get_descriptors = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

    +376:         self._local_type_set_or_del_descriptors = sets_or_dels

      if (!(likely(PySet_CheckExact(__pyx_v_sets_or_dels))||((__pyx_v_sets_or_dels) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", __Pyx_PyType_Name(Py_TYPE(__pyx_v_sets_or_dels))), 0))) __PYX_ERR(0, 376, __pyx_L1_error)
      __pyx_t_4 = __pyx_v_sets_or_dels;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_local_type_set_or_del_descriptors);
      __Pyx_DECREF(__pyx_v_self->_local_type_set_or_del_descriptors);
      __pyx_v_self->_local_type_set_or_del_descriptors = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

    +377:         self._local_type_del_descriptors = dels

      if (!(likely(PySet_CheckExact(__pyx_v_dels))||((__pyx_v_dels) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", __Pyx_PyType_Name(Py_TYPE(__pyx_v_dels))), 0))) __PYX_ERR(0, 377, __pyx_L1_error)
      __pyx_t_4 = __pyx_v_dels;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_local_type_del_descriptors);
      __Pyx_DECREF(__pyx_v_self->_local_type_del_descriptors);
      __pyx_v_self->_local_type_del_descriptors = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

    +378:         self._local_type_set_descriptors = sets

      if (!(likely(PySet_CheckExact(__pyx_v_sets))||((__pyx_v_sets) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", __Pyx_PyType_Name(Py_TYPE(__pyx_v_sets))), 0))) __PYX_ERR(0, 378, __pyx_L1_error)
      __pyx_t_4 = __pyx_v_sets;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_local_type_set_descriptors);
      __Pyx_DECREF(__pyx_v_self->_local_type_set_descriptors);
      __pyx_v_self->_local_type_set_descriptors = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

    +379:         self._local_type = type(self)

      __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_local_type);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_local_type);
      __pyx_v_self->_local_type = ((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));

    +380:         self._local_type_vars = set(dir(self._local_type))

      __pyx_t_4 = ((PyObject *)__pyx_v_self->_local_type);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = PyObject_Dir(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PySet_New(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_v_self->_local_type_vars);
      __Pyx_DECREF(__pyx_v_self->_local_type_vars);
      __pyx_v_self->_local_type_vars = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;

     381:

    +382:     def __getattribute__(self, name): # pylint:disable=too-many-return-statements

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_5local_3__getattribute__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
    static PyObject *__pyx_pw_6gevent_6_local_5local_3__getattribute__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__getattribute__ (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_6_local_5local_2__getattribute__(((struct __pyx_obj_6gevent_6_local_local *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

    static PyObject *__pyx_pf_6gevent_6_local_5local_2__getattribute__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, PyObject *__pyx_v_name) {
      PyObject *__pyx_v_dct = NULL;
      PyObject *__pyx_v_type_attr = NULL;
      PyObject *__pyx_v_base = NULL;
      PyObject *__pyx_v_bd = NULL;
      PyObject *__pyx_v_attr_on_type = NULL;
      PyObject *__pyx_v_result = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__getattribute__", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("gevent._local.local.__getattribute__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dct);
      __Pyx_XDECREF(__pyx_v_type_attr);
      __Pyx_XDECREF(__pyx_v_base);
      __Pyx_XDECREF(__pyx_v_bd);
      __Pyx_XDECREF(__pyx_v_attr_on_type);
      __Pyx_XDECREF(__pyx_v_result);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +383:         if name in _local_attrs:

      if (unlikely(__pyx_v_6gevent_6_local__local_attrs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 383, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_6gevent_6_local__local_attrs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 383, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {
    /* … */
      }

     384:             # The _local__impl,  __cinit__, etc, won't be hit by the

     385:             # Cython version, if we've done things right. If we haven't,

     386:             # they will be, and this will produce an error.

    +387:             return object.__getattribute__(self, name)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattribute); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_6 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

     388:

    +389:         dct = _local_get_dict(self)

      __pyx_t_3 = __pyx_f_6gevent_6_local__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_dct = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

     390:

    +391:         if name == '__dict__':

      __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_dict, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
      if (__pyx_t_2) {
    /* … */
      }

    +392:             return dct

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

     393:         # If there's no possible way we can switch, because this

     394:         # attribute is *not* found in the class where it might be a

     395:         # data descriptor (property), and it *is* in the dict

     396:         # then we don't need to swizzle the dict and take the lock.

     397:

     398:         # We don't have to worry about people overriding __getattribute__

     399:         # because if they did, the dict-swizzling would only last as

     400:         # long as we were in here anyway.

     401:         # Similarly, a __getattr__ will still be called by _oga() if needed

     402:         # if it's not in the dict.

     403:

     404:         # Optimization: If we're not subclassed, then

     405:         # there can be no descriptors except for methods, which will

     406:         # never need to use __dict__.

    +407:         if self._local_type is local:

      __pyx_t_2 = (__pyx_v_self->_local_type == __pyx_ptype_6gevent_6_local_local);
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +408:             return dct[name] if name in dct else object.__getattribute__(self, name)

        __Pyx_XDECREF(__pyx_r);
        if (unlikely(__pyx_v_dct == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 408, __pyx_L1_error)
        }
        __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_dct, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 408, __pyx_L1_error)
        if ((__pyx_t_1 != 0)) {
          if (unlikely(__pyx_v_dct == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 408, __pyx_L1_error)
          }
          __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = __pyx_t_4;
          __pyx_t_4 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_getattribute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 408, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_7 = NULL;
          __pyx_t_8 = 0;
          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_8 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_7, ((PyObject *)__pyx_v_self), __pyx_v_name};
            __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __pyx_t_3 = __pyx_t_4;
          __pyx_t_4 = 0;
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

     409:

     410:         # NOTE: If this is a descriptor, this will invoke its __get__.

     411:         # A broken descriptor that doesn't return itself when called with

     412:         # a None for the instance argument could mess us up here.

     413:         # But this is faster than a loop over mro() checking each class __dict__

     414:         # manually.

    +415:         if name in dct:

      if (unlikely(__pyx_v_dct == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 415, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_dct, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 415, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +416:             if name not in self._local_type_vars:

        if (unlikely(__pyx_v_self->_local_type_vars == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 416, __pyx_L1_error)
        }
        __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_vars, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 416, __pyx_L1_error)
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (__pyx_t_1) {
    /* … */
        }

     417:                 # If there is a dict value, and nothing in the type,

     418:                 # it can't possibly be a descriptor, so it is just returned.

    +419:                 return dct[name]

          __Pyx_XDECREF(__pyx_r);
          if (unlikely(__pyx_v_dct == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 419, __pyx_L1_error)
          }
          __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

     420:

     421:             # It's in the type *and* in the dict. If the type value is

     422:             # a data descriptor (defines __get__ *and* either __set__ or

     423:             # __delete__), then the type wins. If it's a non-data descriptor

     424:             # (defines just __get__), then the instance wins. If it's not a

     425:             # descriptor at all (doesn't have __get__), the instance wins.

     426:             # NOTE that the docs for descriptors say that these methods must be

     427:             # defined on the *class* of the object in the type.

    +428:             if name not in self._local_type_get_descriptors:

        if (unlikely(__pyx_v_self->_local_type_get_descriptors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 428, __pyx_L1_error)
        }
        __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_get_descriptors, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 428, __pyx_L1_error)
        __pyx_t_2 = (__pyx_t_1 != 0);
        if (__pyx_t_2) {
    /* … */
        }

     429:                 # Entirely not a descriptor. Instance wins.

    +430:                 return dct[name]

          __Pyx_XDECREF(__pyx_r);
          if (unlikely(__pyx_v_dct == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 430, __pyx_L1_error)
          }
          __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

    +431:             if name in self._local_type_set_or_del_descriptors:

        if (unlikely(__pyx_v_self->_local_type_set_or_del_descriptors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 431, __pyx_L1_error)
        }
        __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_set_or_del_descriptors, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 431, __pyx_L1_error)
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (__pyx_t_1) {
    /* … */
        }

     432:                 # A data descriptor.

     433:                 # arbitrary code execution while these run. If they touch self again,

     434:                 # they'll call back into us and we'll repeat the dance.

    +435:                 type_attr = getattr(self._local_type, name)

          __pyx_t_3 = ((PyObject *)__pyx_v_self->_local_type);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_GetAttr(__pyx_t_3, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_type_attr = __pyx_t_4;
          __pyx_t_4 = 0;

    +436:                 return type(type_attr).__get__(type_attr, self, self._local_type)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_type_attr)), __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = NULL;
          __pyx_t_9 = 0;
          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_9 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_type_attr, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_self->_local_type)};
            __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 3+__pyx_t_9);
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 436, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_r = __pyx_t_4;
          __pyx_t_4 = 0;
          goto __pyx_L0;

     437:             # Last case is a non-data descriptor. Instance wins.

    +438:             return dct[name]

        __Pyx_XDECREF(__pyx_r);
        if (unlikely(__pyx_v_dct == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 438, __pyx_L1_error)
        }
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;

     439:

    +440:         if name in self._local_type_vars:

      if (unlikely(__pyx_v_self->_local_type_vars == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 440, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_vars, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 440, __pyx_L1_error)
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {
    /* … */
      }

     441:             # Not in the dictionary, but is found in the type. It could be

     442:             # a non-data descriptor still. Some descriptors, like @staticmethod,

     443:             # return objects (functions, in this case), that are *themselves*

     444:             # descriptors, which when invoked, again, would do the wrong thing.

     445:             # So we can't rely on getattr() on the type for them, we have to

     446:             # look through the MRO dicts ourself.

    +447:             if name not in self._local_type_get_descriptors:

        if (unlikely(__pyx_v_self->_local_type_get_descriptors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 447, __pyx_L1_error)
        }
        __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_get_descriptors, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 447, __pyx_L1_error)
        __pyx_t_1 = (__pyx_t_2 != 0);
        if (__pyx_t_1) {
    /* … */
        }

     448:                 # Not a descriptor, can't execute code. So all we need is

     449:                 # the return value of getattr() on our type.

    +450:                 return getattr(self._local_type, name)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_4 = ((PyObject *)__pyx_v_self->_local_type);
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_3 = __Pyx_GetAttr(__pyx_t_4, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

     451:

    +452:             for base in self._local_type.mro():

        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_local_type), __pyx_n_s_mro); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_10 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[1] = {__pyx_t_5, };
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
          __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_11 = 0;
          __pyx_t_12 = NULL;
        } else {
          __pyx_t_11 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 452, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        for (;;) {
          if (likely(!__pyx_t_12)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 452, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            } else {
              if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 452, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            }
          } else {
            __pyx_t_3 = __pyx_t_12(__pyx_t_4);
            if (unlikely(!__pyx_t_3)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 452, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_3);
          }
          __Pyx_XDECREF_SET(__pyx_v_base, __pyx_t_3);
          __pyx_t_3 = 0;
    /* … */
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +453:                 bd = base.__dict__

          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_XDECREF_SET(__pyx_v_bd, __pyx_t_3);
          __pyx_t_3 = 0;

    +454:                 if name in bd:

          __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_bd, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 454, __pyx_L1_error)
          __pyx_t_2 = (__pyx_t_1 != 0);
          if (__pyx_t_2) {
    /* … */
          }

    +455:                     attr_on_type = bd[name]

            __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_bd, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_v_attr_on_type = __pyx_t_3;
            __pyx_t_3 = 0;

    +456:                     result = type(attr_on_type).__get__(attr_on_type, self, self._local_type)

            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_attr_on_type)), __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_7 = NULL;
            __pyx_t_13 = 0;
            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_13 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[4] = {__pyx_t_7, __pyx_v_attr_on_type, ((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_self->_local_type)};
              __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_13, 3+__pyx_t_13);
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            }
            __pyx_v_result = __pyx_t_3;
            __pyx_t_3 = 0;

    +457:                     return result

            __Pyx_XDECREF(__pyx_r);
            __Pyx_INCREF(__pyx_v_result);
            __pyx_r = __pyx_v_result;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            goto __pyx_L0;

     458:

     459:         # It wasn't in the dict and it wasn't in the type.

     460:         # So the next step is to invoke type(self)__getattr__, if it

     461:         # exists, otherwise raise an AttributeError.

     462:         # we will invoke type(self).__getattr__ or raise an attribute error.

    +463:         if hasattr(self._local_type, '__getattr__'):

      __pyx_t_4 = ((PyObject *)__pyx_v_self->_local_type);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_HasAttr(__pyx_t_4, __pyx_n_s_getattr); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +464:             return self._local_type.__getattr__(self, name)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_local_type), __pyx_n_s_getattr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = NULL;
        __pyx_t_14 = 0;
        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_14 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_14, 2+__pyx_t_14);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;

    +465:         raise AttributeError("%r object has no attribute '%s'"

      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 465, __pyx_L1_error)

    +466:                              % (self._local_type.__name__, name))

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_local_type), __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_name);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_r_object_has_no_attribute_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     467:

    +468:     def __setattr__(self, name, value):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_5local_5__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/
    static int __pyx_pw_6gevent_6_local_5local_5__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_6_local_5local_4__setattr__(((struct __pyx_obj_6gevent_6_local_local *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_value));

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

    static int __pyx_pf_6gevent_6_local_5local_4__setattr__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
      PyObject *__pyx_v_dct = NULL;
      PyObject *__pyx_v_type_attr = NULL;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__setattr__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("gevent._local.local.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dct);
      __Pyx_XDECREF(__pyx_v_type_attr);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +469:         if name == '__dict__':

      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_dict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 469, __pyx_L1_error)
      if (unlikely(__pyx_t_1)) {
    /* … */
      }

    +470:             raise AttributeError(

        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_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, 470, __pyx_L1_error)

     471:                 "%r object attribute '__dict__' is read-only"

    +472:                 % type(self))

        __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_r_object_attribute___dict___is, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);

     473:

    +474:         if name in _local_attrs:

      if (unlikely(__pyx_v_6gevent_6_local__local_attrs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 474, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_6gevent_6_local__local_attrs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 474, __pyx_L1_error)
      __pyx_t_4 = (__pyx_t_1 != 0);
      if (__pyx_t_4) {
    /* … */
      }

    +475:             object.__setattr__(self, name, value)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_setattr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && likely(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_6 = 1;
          }
        }
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_name, __pyx_v_value};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 3+__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 475, __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;

    +476:             return

        __pyx_r = 0;
        goto __pyx_L0;

     477:

    +478:         dct = _local_get_dict(self)

      __pyx_t_3 = __pyx_f_6gevent_6_local__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_dct = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

     479:

    +480:         if self._local_type is local:

      __pyx_t_4 = (__pyx_v_self->_local_type == __pyx_ptype_6gevent_6_local_local);
      __pyx_t_1 = (__pyx_t_4 != 0);
      if (__pyx_t_1) {
    /* … */
      }

     481:             # Optimization: If we're not subclassed, we can't

     482:             # have data descriptors, so this goes right in the dict.

    +483:             dct[name] = value

        if (unlikely(__pyx_v_dct == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 483, __pyx_L1_error)
        }
        if (unlikely(PyDict_SetItem(__pyx_v_dct, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 483, __pyx_L1_error)

    +484:             return

        __pyx_r = 0;
        goto __pyx_L0;

     485:

    +486:         if name in self._local_type_vars:

      if (unlikely(__pyx_v_self->_local_type_vars == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 486, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_vars, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 486, __pyx_L1_error)
      __pyx_t_4 = (__pyx_t_1 != 0);
      if (__pyx_t_4) {
    /* … */
      }

    +487:             if name in self._local_type_set_descriptors:

        if (unlikely(__pyx_v_self->_local_type_set_descriptors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 487, __pyx_L1_error)
        }
        __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_set_descriptors, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
        __pyx_t_1 = (__pyx_t_4 != 0);
        if (__pyx_t_1) {
    /* … */
        }

    +488:                 type_attr = getattr(self._local_type, name, _marker)

          __pyx_t_3 = ((PyObject *)__pyx_v_self->_local_type);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_2 = __pyx_v_6gevent_6_local__marker;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_GetAttr3(__pyx_t_3, __pyx_v_name, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 488, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_type_attr = __pyx_t_5;
          __pyx_t_5 = 0;

     489:                 # A data descriptor, like a property or a slot.

    +490:                 type(type_attr).__set__(type_attr, self, value)

          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_type_attr)), __pyx_n_s_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = NULL;
          __pyx_t_7 = 0;
          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_7 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_type_attr, ((PyObject *)__pyx_v_self), __pyx_v_value};
            __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 3+__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +491:                 return

          __pyx_r = 0;
          goto __pyx_L0;

     492:         # Otherwise it goes directly in the dict

    +493:         dct[name] = value

      if (unlikely(__pyx_v_dct == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 493, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_dct, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 493, __pyx_L1_error)

     494:

    +495:     def __delattr__(self, name):

    /* Python wrapper */
    static int __pyx_pw_6gevent_6_local_5local_7__delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
    static int __pyx_pw_6gevent_6_local_5local_7__delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__delattr__ (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_6_local_5local_6__delattr__(((struct __pyx_obj_6gevent_6_local_local *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

    static int __pyx_pf_6gevent_6_local_5local_6__delattr__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, PyObject *__pyx_v_name) {
      PyObject *__pyx_v_type_attr = NULL;
      PyObject *__pyx_v_dct = NULL;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__delattr__", 0);
    /* … */
      /* function exit code */
      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_AddTraceback("gevent._local.local.__delattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_type_attr);
      __Pyx_XDECREF(__pyx_v_dct);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +496:         if name == '__dict__':

      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_dict, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 496, __pyx_L1_error)
      if (unlikely(__pyx_t_1)) {
    /* … */
      }

    +497:             raise AttributeError(

        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_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, 497, __pyx_L1_error)

     498:                 "%r object attribute '__dict__' is read-only"

    +499:                 % self.__class__.__name__)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_r_object_attribute___dict___is, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     500:

    +501:         if name in self._local_type_vars:

      if (unlikely(__pyx_v_self->_local_type_vars == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 501, __pyx_L1_error)
      }
      __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_vars, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 501, __pyx_L1_error)
      __pyx_t_4 = (__pyx_t_1 != 0);
      if (__pyx_t_4) {
    /* … */
      }

    +502:             if name in self._local_type_del_descriptors:

        if (unlikely(__pyx_v_self->_local_type_del_descriptors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 502, __pyx_L1_error)
        }
        __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_self->_local_type_del_descriptors, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 502, __pyx_L1_error)
        __pyx_t_1 = (__pyx_t_4 != 0);
        if (__pyx_t_1) {
    /* … */
        }

     503:                 # A data descriptor, like a property or a slot.

    +504:                 type_attr = getattr(self._local_type, name, _marker)

          __pyx_t_3 = ((PyObject *)__pyx_v_self->_local_type);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_2 = __pyx_v_6gevent_6_local__marker;
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_GetAttr3(__pyx_t_3, __pyx_v_name, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 504, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_type_attr = __pyx_t_5;
          __pyx_t_5 = 0;

    +505:                 type(type_attr).__delete__(type_attr, self)

          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_type_attr)), __pyx_n_s_delete); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = NULL;
          __pyx_t_6 = 0;
          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_6 = 1;
            }
          }
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_type_attr, ((PyObject *)__pyx_v_self)};
            __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 505, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +506:                 return

          __pyx_r = 0;
          goto __pyx_L0;

     507:         # Otherwise it goes directly in the dict

     508:

     509:         # Begin inlined function _get_dict()

    +510:         dct = _local_get_dict(self)

      __pyx_t_5 = __pyx_f_6gevent_6_local__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_dct = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

     511:

    +512:         try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_try_end;
        __pyx_L6_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L11_try_end:;
      }

    +513:             del dct[name]

          if (unlikely(__pyx_v_dct == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 513, __pyx_L6_error)
          }
          if (unlikely(PyDict_DelItem(__pyx_v_dct, __pyx_v_name) < 0)) __PYX_ERR(0, 513, __pyx_L6_error)

    +514:         except KeyError:

        __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
        if (__pyx_t_10) {
          __Pyx_AddTraceback("gevent._local.local.__delattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 514, __pyx_L8_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_3);

    +515:             raise AttributeError(name)

          __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L8_except_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_Raise(__pyx_t_11, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __PYX_ERR(0, 515, __pyx_L8_except_error)
        }
        goto __pyx_L8_except_error;
        __pyx_L8_except_error:;

     516:

    +517:     def __copy__(self):

    static PyObject *__pyx_pw_6gevent_6_local_5local_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static struct __pyx_obj_6gevent_6_local_local *__pyx_f_6gevent_6_local_5local___copy__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, int __pyx_skip_dispatch) {
      struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *__pyx_v_entry = 0;
      PyObject *__pyx_v_dct = 0;
      PyObject *__pyx_v_duplicate = 0;
      struct __pyx_obj_6gevent_6_local_local *__pyx_v_instance = 0;
      struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_impl = NULL;
      PyTypeObject *__pyx_v_cls = NULL;
      struct __pyx_obj_6gevent_6_local_local *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__copy__", 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 && 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_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
          #endif
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_local_5local_9__copy__)) {
            __Pyx_XDECREF((PyObject *)__pyx_r);
            __Pyx_INCREF(__pyx_t_1);
            __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
            __pyx_t_5 = 0;
            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_5 = 1;
              }
            }
            {
              PyObject *__pyx_callargs[1] = {__pyx_t_4, };
              __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6gevent_6_local_local))))) __PYX_ERR(0, 517, __pyx_L1_error)
            __pyx_r = ((struct __pyx_obj_6gevent_6_local_local *)__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_type_dict_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._local.local.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_entry);
      __Pyx_XDECREF(__pyx_v_dct);
      __Pyx_XDECREF(__pyx_v_duplicate);
      __Pyx_XDECREF((PyObject *)__pyx_v_instance);
      __Pyx_XDECREF((PyObject *)__pyx_v_impl);
      __Pyx_XDECREF((PyObject *)__pyx_v_cls);
      __Pyx_XGIVEREF((PyObject *)__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_5local_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_6_local_5local_8__copy__, "local.__copy__(self) -> local");
    static PyMethodDef __pyx_mdef_6gevent_6_local_5local_9__copy__ = {"__copy__", (PyCFunction)__pyx_pw_6gevent_6_local_5local_9__copy__, METH_NOARGS, __pyx_doc_6gevent_6_local_5local_8__copy__};
    static PyObject *__pyx_pw_6gevent_6_local_5local_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
      __pyx_r = __pyx_pf_6gevent_6_local_5local_8__copy__(((struct __pyx_obj_6gevent_6_local_local *)__pyx_v_self));

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

    static PyObject *__pyx_pf_6gevent_6_local_5local_8__copy__(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__copy__", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_6_local_5local___copy__(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __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._local.local.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 517, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__8);
      __Pyx_GIVEREF(__pyx_tuple__8);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_5local_9__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_local___copy, NULL, __pyx_n_s_gevent__local, __pyx_t_1, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        #else
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_5local_9__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_local___copy, NULL, __pyx_n_s_gevent__local, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error)
        #endif
        __Pyx_GOTREF(__pyx_t_2);
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_2);
        if (PyModule_AddObject(__pyx_m, __pyx_k_copy, __pyx_t_2) < 0) __PYX_ERR(0, 517, __pyx_L1_error)
        #else
        if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_local_local->tp_dict, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 517, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        PyType_Modified(__pyx_ptype_6gevent_6_local_local);
      __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_local_py, __pyx_n_s_copy, 517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 517, __pyx_L1_error)

    +518:         impl = self._local__impl

      __pyx_t_1 = ((PyObject *)__pyx_v_self->_local__impl);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_impl = ((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_t_1);
      __pyx_t_1 = 0;

    +519:         entry = impl.dicts[id(getcurrent())]  # pylint:disable=undefined-variable

      if (unlikely(__pyx_v_impl->dicts == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 519, __pyx_L1_error)
      }
      __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_6_local_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_impl->dicts, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_6_local__localimpl_dict_entry))))) __PYX_ERR(0, 519, __pyx_L1_error)
      __pyx_v_entry = ((struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *)__pyx_t_1);
      __pyx_t_1 = 0;

     520:

    +521:         dct = entry.localdict

      __pyx_t_1 = __pyx_v_entry->localdict;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_dct = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +522:         duplicate = copy(dct)

      __Pyx_INCREF(__pyx_v_6gevent_6_local_copy);
      __pyx_t_2 = __pyx_v_6gevent_6_local_copy; __pyx_t_3 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_6 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_dct};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", __Pyx_PyType_Name(Py_TYPE(__pyx_t_1))), 0))) __PYX_ERR(0, 522, __pyx_L1_error)
      __pyx_v_duplicate = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     523:

    +524:         cls = type(self)

      __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __pyx_v_cls = ((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));

    +525:         instance = cls(*impl.localargs, **impl.localkwargs)

      if (unlikely(__pyx_v_impl->localargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 525, __pyx_L1_error)
      }
      if (unlikely(__pyx_v_impl->localkwargs == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 525, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_v_impl->localargs, __pyx_v_impl->localkwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_6_local_local))))) __PYX_ERR(0, 525, __pyx_L1_error)
      __pyx_v_instance = ((struct __pyx_obj_6gevent_6_local_local *)__pyx_t_1);
      __pyx_t_1 = 0;

    +526:         _local__copy_dict_from(instance, impl, duplicate)

      __pyx_t_1 = __pyx_f_6gevent_6_local__local__copy_dict_from(__pyx_v_instance, __pyx_v_impl, __pyx_v_duplicate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +527:         return instance

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

     528:

    +529: def _local__copy_dict_from(self, impl, duplicate):

    static PyObject *__pyx_f_6gevent_6_local__local__copy_dict_from(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self, struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_impl, PyObject *__pyx_v_duplicate) {
      struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *__pyx_v_entry = 0;
      PyGreenlet *__pyx_v_current = NULL;
      PyObject *__pyx_v_currentId = NULL;
      struct __pyx_obj_6gevent_6_local__localimpl *__pyx_v_new_impl = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_local__copy_dict_from", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("gevent._local._local__copy_dict_from", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_entry);
      __Pyx_XDECREF((PyObject *)__pyx_v_current);
      __Pyx_XDECREF(__pyx_v_currentId);
      __Pyx_XDECREF((PyObject *)__pyx_v_new_impl);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

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

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

    +531:     currentId = id(current)

      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_current)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_currentId = __pyx_t_1;
      __pyx_t_1 = 0;

    +532:     new_impl = self._local__impl

      __pyx_t_1 = ((PyObject *)__pyx_v_self->_local__impl);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_new_impl = ((struct __pyx_obj_6gevent_6_local__localimpl *)__pyx_t_1);
      __pyx_t_1 = 0;

    +533:     assert new_impl is not impl

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (__pyx_v_new_impl != __pyx_v_impl);
        if (unlikely(!(__pyx_t_2 != 0))) {
          PyErr_SetNone(PyExc_AssertionError);
          __PYX_ERR(0, 533, __pyx_L1_error)
        }
      }
      #endif

    +534:     entry = new_impl.dicts[currentId]

      if (unlikely(__pyx_v_new_impl->dicts == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 534, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_new_impl->dicts, __pyx_v_currentId); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_6_local__localimpl_dict_entry))))) __PYX_ERR(0, 534, __pyx_L1_error)
      __pyx_v_entry = ((struct __pyx_obj_6gevent_6_local__localimpl_dict_entry *)__pyx_t_1);
      __pyx_t_1 = 0;

    +535:     new_impl.dicts[currentId] = _localimpl_dict_entry(entry.wrgreenlet, duplicate)

      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_entry->wrgreenlet);
      __Pyx_GIVEREF(__pyx_v_entry->wrgreenlet);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_entry->wrgreenlet);
      __Pyx_INCREF(__pyx_v_duplicate);
      __Pyx_GIVEREF(__pyx_v_duplicate);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_duplicate);
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_local__localimpl_dict_entry), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_new_impl->dicts == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 535, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_new_impl->dicts, __pyx_v_currentId, __pyx_t_3) < 0)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     536:

    +537: def _local_find_descriptors(self):

    static PyObject *__pyx_f_6gevent_6_local__local_find_descriptors(struct __pyx_obj_6gevent_6_local_local *__pyx_v_self) {
      PyObject *__pyx_v_mro = 0;
      PyObject *__pyx_v_gets = 0;
      PyObject *__pyx_v_dels = 0;
      PyObject *__pyx_v_set_or_del = 0;
      PyTypeObject *__pyx_v_type_self = 0;
      PyTypeObject *__pyx_v_type_attr = 0;
      PyObject *__pyx_v_sets = 0;
      PyObject *__pyx_v_attr_name = NULL;
      PyObject *__pyx_v_base = NULL;
      PyObject *__pyx_v_bd = NULL;
      PyObject *__pyx_v_attr = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_local_find_descriptors", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("gevent._local._local_find_descriptors", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_mro);
      __Pyx_XDECREF(__pyx_v_gets);
      __Pyx_XDECREF(__pyx_v_dels);
      __Pyx_XDECREF(__pyx_v_set_or_del);
      __Pyx_XDECREF((PyObject *)__pyx_v_type_self);
      __Pyx_XDECREF((PyObject *)__pyx_v_type_attr);
      __Pyx_XDECREF(__pyx_v_sets);
      __Pyx_XDECREF(__pyx_v_attr_name);
      __Pyx_XDECREF(__pyx_v_base);
      __Pyx_XDECREF(__pyx_v_bd);
      __Pyx_XDECREF(__pyx_v_attr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +538:     type_self = type(self)

      __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
      __pyx_v_type_self = ((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));

    +539:     gets = set()

      __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_gets = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +540:     dels = set()

      __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_dels = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +541:     set_or_del = set()

      __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_set_or_del = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +542:     sets = set()

      __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_sets = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +543:     mro = list(type_self.mro())

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_type_self), __pyx_n_s_mro); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      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_4 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[1] = {__pyx_t_3, };
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_mro = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

     544:

    +545:     for attr_name in dir(type_self):

      __pyx_t_2 = PyObject_Dir(((PyObject *)__pyx_v_type_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_6(__pyx_t_1);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 545, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_attr_name, __pyx_t_2);
        __pyx_t_2 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     546:         # Conventionally, descriptors when called on a class

     547:         # return themself, but not all do. Notable exceptions are

     548:         # in the zope.interface package, where things like __provides__

     549:         # return other class attributes. So we can't use getattr, and instead

     550:         # walk up the dicts

    +551:         for base in mro:

        __pyx_t_2 = __pyx_v_mro; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
        for (;;) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_base, __pyx_t_3);
          __pyx_t_3 = 0;
    /* … */
        }
        /*else*/ {
    /* … */
        __pyx_L6_break:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +552:             bd = base.__dict__

          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_XDECREF_SET(__pyx_v_bd, __pyx_t_3);
          __pyx_t_3 = 0;

    +553:             if attr_name in bd:

          __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_attr_name, __pyx_v_bd, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 553, __pyx_L1_error)
          __pyx_t_9 = (__pyx_t_8 != 0);
          if (__pyx_t_9) {
    /* … */
          }

    +554:                 attr = bd[attr_name]

            __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_bd, __pyx_v_attr_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_XDECREF_SET(__pyx_v_attr, __pyx_t_3);
            __pyx_t_3 = 0;

    +555:                 break

            goto __pyx_L6_break;

     556:         else:

    +557:             raise AttributeError(attr_name)

          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_attr_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(0, 557, __pyx_L1_error)
        }

     558:

    +559:         type_attr = type(attr)

        __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_attr)));
        __Pyx_XDECREF_SET(__pyx_v_type_attr, ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_attr))));

    +560:         if hasattr(type_attr, '__get__'):

        __pyx_t_9 = __Pyx_HasAttr(((PyObject *)__pyx_v_type_attr), __pyx_n_s_get); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 560, __pyx_L1_error)
        __pyx_t_8 = (__pyx_t_9 != 0);
        if (__pyx_t_8) {
    /* … */
        }

    +561:             gets.add(attr_name)

          __pyx_t_10 = PySet_Add(__pyx_v_gets, __pyx_v_attr_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 561, __pyx_L1_error)

    +562:         if hasattr(type_attr, '__delete__'):

        __pyx_t_8 = __Pyx_HasAttr(((PyObject *)__pyx_v_type_attr), __pyx_n_s_delete); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 562, __pyx_L1_error)
        __pyx_t_9 = (__pyx_t_8 != 0);
        if (__pyx_t_9) {
    /* … */
        }

    +563:             dels.add(attr_name)

          __pyx_t_10 = PySet_Add(__pyx_v_dels, __pyx_v_attr_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 563, __pyx_L1_error)

    +564:             set_or_del.add(attr_name)

          __pyx_t_10 = PySet_Add(__pyx_v_set_or_del, __pyx_v_attr_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 564, __pyx_L1_error)

    +565:         if hasattr(type_attr, '__set__'):

        __pyx_t_9 = __Pyx_HasAttr(((PyObject *)__pyx_v_type_attr), __pyx_n_s_set); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 565, __pyx_L1_error)
        __pyx_t_8 = (__pyx_t_9 != 0);
        if (__pyx_t_8) {
    /* … */
        }

    +566:             sets.add(attr_name)

          __pyx_t_10 = PySet_Add(__pyx_v_sets, __pyx_v_attr_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 566, __pyx_L1_error)

     567:

    +568:     return (gets, dels, set_or_del, sets)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_gets);
      __Pyx_GIVEREF(__pyx_v_gets);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_gets);
      __Pyx_INCREF(__pyx_v_dels);
      __Pyx_GIVEREF(__pyx_v_dels);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dels);
      __Pyx_INCREF(__pyx_v_set_or_del);
      __Pyx_GIVEREF(__pyx_v_set_or_del);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_set_or_del);
      __Pyx_INCREF(__pyx_v_sets);
      __Pyx_GIVEREF(__pyx_v_sets);
      PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_sets);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

     569:

     570: # Cython doesn't let us use __new__, it requires

     571: # __cinit__. But we need __new__ if we're not compiled

     572: # (e.g., on PyPy). So we set it at runtime. Cython

     573: # will raise an error if we're compiled.

    +574: def __new__(cls, *args, **kw):

    /* Python wrapper */
    static PyObject *__pyx_pw_6gevent_6_local_3__new__(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_6gevent_6_local_2__new__, "__new__(cls, *args, **kw)");
    static PyMethodDef __pyx_mdef_6gevent_6_local_3__new__ = {"__new__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_6_local_3__new__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_6_local_2__new__};
    static PyObject *__pyx_pw_6gevent_6_local_3__new__(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_cls = 0;
      PyObject *__pyx_v_args = 0;
      PyObject *__pyx_v_kw = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
      __pyx_v_kw = PyDict_New(); if (unlikely(!__pyx_v_kw)) return NULL;
      __Pyx_GOTREF(__pyx_v_kw);
      __pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
      if (unlikely(!__pyx_v_args)) {
        __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
        __Pyx_RefNannyFinishContext();
        return NULL;
      }
      __Pyx_GOTREF(__pyx_v_args);
      {
        #if CYTHON_COMPILING_IN_LIMITED_API
        PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,0};
        #else
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,0};
        #endif
        PyObject* values[1] = {0};
        if (__pyx_kwds) {
          Py_ssize_t kw_args;
          switch (__pyx_nargs) {
            default:
            case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
          }
          kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
          switch (__pyx_nargs) {
            case  0:
            if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cls)) != 0)) kw_args--;
            else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 574, __pyx_L3_error)
            else goto __pyx_L5_argtuple_error;
          }
          if (unlikely(kw_args > 0)) {
            const Py_ssize_t kwd_pos_args = __pyx_nargs;
            const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kw, values + 0, used_pos_args, "__new__") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
          }
        } else if (unlikely(__pyx_nargs < 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        }
        __pyx_v_cls = values[0];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__new__", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 574, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
      __Pyx_DECREF(__pyx_v_kw); __pyx_v_kw = 0;
      __Pyx_AddTraceback("gevent._local.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6gevent_6_local_2__new__(__pyx_self, __pyx_v_cls, __pyx_v_args, __pyx_v_kw);

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

    static PyObject *__pyx_pf_6gevent_6_local_2__new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kw) {
      PyObject *__pyx_v_self = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__new__", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("gevent._local.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_self);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple__10 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_args, __pyx_n_s_kw, __pyx_n_s_self); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__10);
      __Pyx_GIVEREF(__pyx_tuple__10);
    /* … */
        #if CYTHON_COMPILING_IN_LIMITED_API
        __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_3__new__, 0, __pyx_n_s_new, NULL, __pyx_n_s_gevent__local, __pyx_t_1, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        #else
        __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_6_local_3__new__, 0, __pyx_n_s_new, NULL, __pyx_n_s_gevent__local, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
        #endif
        __Pyx_GOTREF(__pyx_t_2);
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_2);
        if (PyModule_AddObject(__pyx_m, __pyx_k_new, __pyx_t_2) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
        #else
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_new, __pyx_t_2) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +575:     self = super(local, cls).__new__(cls)

      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF((PyObject *)__pyx_ptype_6gevent_6_local_local);
      __Pyx_GIVEREF((PyObject *)__pyx_ptype_6gevent_6_local_local);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6gevent_6_local_local));
      __Pyx_INCREF(__pyx_v_cls);
      __Pyx_GIVEREF(__pyx_v_cls);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_cls);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_4 = 0;
      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_4 = 1;
        }
      }
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_cls};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_v_self = __pyx_t_1;
      __pyx_t_1 = 0;

     576:     # We get the cls in *args for some reason

     577:     # too when we do it this way....except on PyPy3, which does

     578:     # not *unless* it's wrapped in a classmethod (which it is)

    +579:     self.__cinit__(*args[1:], **kw)

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cinit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_v_args, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_kw); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __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;

    +580:     return self

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

     581:

    +582: try:

        {
          /*try:*/ {
    /* … */
          }
    /* … */
          __Pyx_XGIVEREF(__pyx_t_3);
          __Pyx_XGIVEREF(__pyx_t_4);
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
          goto __pyx_L1_error;
          __pyx_L3_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_3);
          __Pyx_XGIVEREF(__pyx_t_4);
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
          __pyx_L7_try_end:;
        }

     583:     # PyPy2/3 and CPython handle adding a __new__ to the class

     584:     # in different ways. In CPython and PyPy3, it must be wrapped with classmethod;

     585:     # in PyPy2, it must not. In either case, the args that get passed to

     586:     # it are stil wrong.

    +587:     local.__new__ = 'None'

            if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_local_local), __pyx_n_s_new, __pyx_n_s_None) < 0) __PYX_ERR(0, 587, __pyx_L2_error)

    +588: except TypeError: # pragma: no cover

          __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
          if (__pyx_t_8) {
            __Pyx_ErrRestore(0,0,0);
            goto __pyx_L3_exception_handled;
          }
          goto __pyx_L4_except_error;
          __pyx_L4_except_error:;

     589:     # Must be compiled

     590:     pass

     591: else:

    +592:     from gevent._compat import PYPY

          /*else:*/ {
            __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_n_s_PYPY_2);
            __Pyx_GIVEREF(__pyx_n_s_PYPY_2);
            PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PYPY_2);
            __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__compat, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L4_except_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_PYPY_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            #if CYTHON_COMPILING_IN_LIMITED_API
            __Pyx_INCREF(__pyx_t_2);
            if (PyModule_AddObject(__pyx_m, __pyx_k_PYPY_2, __pyx_t_2) < 0) __PYX_ERR(0, 592, __pyx_L4_except_error)
            #else
            if (PyDict_SetItem(__pyx_d, __pyx_n_s_PYPY_2, __pyx_t_2) < 0) __PYX_ERR(0, 592, __pyx_L4_except_error)
            #endif
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +593:     from gevent._compat import PY2

            __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_n_s_PY2);
            __Pyx_GIVEREF(__pyx_n_s_PY2);
            PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PY2);
            __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__compat, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 593, __pyx_L4_except_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_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_1);
            #if CYTHON_COMPILING_IN_LIMITED_API
            __Pyx_INCREF(__pyx_t_1);
            if (PyModule_AddObject(__pyx_m, __pyx_k_PY2, __pyx_t_1) < 0) __PYX_ERR(0, 593, __pyx_L4_except_error)
            #else
            if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_1) < 0) __PYX_ERR(0, 593, __pyx_L4_except_error)
            #endif
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +594:     if PYPY and PY2:

            __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PYPY_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 594, __pyx_L4_except_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (__pyx_t_7) {
            } else {
              __pyx_t_6 = __pyx_t_7;
              goto __pyx_L9_bool_binop_done;
            }
            __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L4_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 594, __pyx_L4_except_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_6 = __pyx_t_7;
            __pyx_L9_bool_binop_done:;
            if (__pyx_t_6) {
    /* … */
              goto __pyx_L8;
            }

    +595:         local.__new__ = __new__

              __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 595, __pyx_L4_except_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_local_local), __pyx_n_s_new, __pyx_t_2) < 0) __PYX_ERR(0, 595, __pyx_L4_except_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     596:     else:

    +597:         local.__new__ = classmethod(__new__)

            /*else*/ {
              __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L4_except_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_classmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L4_except_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_local_local), __pyx_n_s_new, __pyx_t_1) < 0) __PYX_ERR(0, 597, __pyx_L4_except_error)
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __pyx_L8:;

     598:

    +599:     del PYPY

            if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PYPY_2) < 0) __PYX_ERR(0, 599, __pyx_L4_except_error)

    +600:     del PY2

            if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PY2) < 0) __PYX_ERR(0, 600, __pyx_L4_except_error)
          }
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          goto __pyx_L7_try_end;
          __pyx_L2_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

     601:

    +602: _init()

        __pyx_f_6gevent_6_local__init();

     603:

    +604: from gevent._util import import_c_accel

        __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __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, 604, __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, 604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #if CYTHON_COMPILING_IN_LIMITED_API
        __Pyx_INCREF(__pyx_t_1);
        if (PyModule_AddObject(__pyx_m, __pyx_k_import_c_accel, __pyx_t_1) < 0) __PYX_ERR(0, 604, __pyx_L1_error)
        #else
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_1) < 0) __PYX_ERR(0, 604, __pyx_L1_error)
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +605: import_c_accel(globals(), 'gevent._local')

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
        __Pyx_INCREF(__pyx_n_s_gevent__local);
        __Pyx_GIVEREF(__pyx_n_s_gevent__local);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_gevent__local);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;