Generated by Cython 3.0.0a9
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_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
002: """
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: >>> import gevent
015: >>> from gevent.local import local
016: >>> mydata = local()
017: >>> mydata.number = 42
018: >>> mydata.number
019: 42
020:
021: You can also access the local-object's dictionary:
022:
023: >>> mydata.__dict__
024: {'number': 42}
025: >>> mydata.__dict__.setdefault('widgets', [])
026: []
027: >>> mydata.widgets
028: []
029:
030: What's important about greenlet-local objects is that their data are
031: local to a greenlet. If we access the data in a different greenlet:
032:
033: >>> log = []
034: >>> def f():
035: ... items = list(mydata.__dict__.items())
036: ... items.sort()
037: ... log.append(items)
038: ... mydata.number = 11
039: ... log.append(mydata.number)
040: >>> greenlet = gevent.spawn(f)
041: >>> greenlet.join()
042: >>> log
043: [[], 11]
044:
045: we get different data. Furthermore, changes made in the other greenlet
046: don't affect data seen in this greenlet:
047:
048: >>> mydata.number
049: 42
050:
051: Of course, values you get from a local object, including a __dict__
052: attribute, are for whatever greenlet was current at the time the
053: attribute was read. For that reason, you generally don't want to save
054: these values across greenlets, as they apply only to the greenlet they
055: came from.
056:
057: You can create custom local objects by subclassing the local class:
058:
059: >>> class MyLocal(local):
060: ... number = 2
061: ... initialized = False
062: ... def __init__(self, **kw):
063: ... if self.initialized:
064: ... raise SystemError('__init__ called too many times')
065: ... self.initialized = True
066: ... self.__dict__.update(kw)
067: ... def squared(self):
068: ... return self.number ** 2
069:
070: This can be useful to support default values, methods and
071: initialization. Note that if you define an __init__ method, it will be
072: called each time the local object is used in a separate greenlet. This
073: is necessary to initialize each greenlet's dictionary.
074:
075: Now if we create a local object:
076:
077: >>> mydata = MyLocal(color='red')
078:
079: Now we have a default number:
080:
081: >>> mydata.number
082: 2
083:
084: an initial color:
085:
086: >>> mydata.color
087: 'red'
088: >>> del mydata.color
089:
090: And a method that operates on the data:
091:
092: >>> mydata.squared()
093: 4
094:
095: As before, we can access the data in a separate greenlet:
096:
097: >>> log = []
098: >>> greenlet = gevent.spawn(f)
099: >>> greenlet.join()
100: >>> log
101: [[('color', 'red'), ('initialized', True)], 11]
102:
103: without affecting this greenlet's data:
104:
105: >>> mydata.number
106: 2
107: >>> mydata.color
108: Traceback (most recent call last):
109: ...
110: AttributeError: 'MyLocal' object has no attribute 'color'
111:
112: Note that subclasses can define slots, but they are not greenlet
113: local. They are shared across greenlets::
114:
115: >>> class MyLocal(local):
116: ... __slots__ = 'number'
117:
118: >>> mydata = MyLocal()
119: >>> mydata.number = 42
120: >>> mydata.color = 'red'
121:
122: So, the separate greenlet:
123:
124: >>> greenlet = gevent.spawn(f)
125: >>> greenlet.join()
126:
127: affects what we see:
128:
129: >>> mydata.number
130: 11
131:
132: >>> del mydata
133:
134: .. versionchanged:: 1.1a2
135: Update the implementation to match Python 3.4 instead of Python 2.5.
136: This results in locals being eligible for garbage collection as soon
137: as their greenlet exits.
138:
139: .. versionchanged:: 1.2.3
140: Use a weak-reference to clear the greenlet link we establish in case
141: the local object dies before the greenlet does.
142:
143: .. versionchanged:: 1.3a1
144: Implement the methods for attribute access directly, handling
145: descriptors directly here. This allows removing the use of a lock
146: and facilitates greatly improved performance.
147:
148: .. versionchanged:: 1.3a1
149: The ``__init__`` method of subclasses of ``local`` is no longer
150: called with a lock held. CPython does not use such a lock in its
151: native implementation. This could potentially show as a difference
152: if code that uses multiple dependent attributes in ``__slots__``
153: (which are shared across all greenlets) switches during ``__init__``.
154:
155: """
156: from __future__ import print_function
157:
+158: from copy import copy
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __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, 158, __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, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_clocal_copy); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_clocal_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;
+159: from weakref import ref
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __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, 159, __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, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_clocal_ref); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_clocal_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;
160:
161:
+162: 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, 162, __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, 162, __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, 162, __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, 162, __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, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
+163: locals()['greenlet_init'] = lambda: None
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_4lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_14_gevent_clocal_4lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_14_gevent_clocal_4lambda, METH_NOARGS, 0}; static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_lambda(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_14_gevent_clocal_lambda(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda", 0); __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_clocal_4lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__gevent_clocal, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __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, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
164:
+165: __all__ = [
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __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 (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
166: "local",
167: ]
168:
169: # The key used in the Thread objects' attribute dicts.
170: # We keep it a string for speed but make it unlikely to clash with
171: # a "real" attribute.
+172: key_prefix = '_gevent_local_localimpl_'
__Pyx_INCREF(__pyx_n_s_gevent_local_localimpl); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_clocal_key_prefix); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_clocal_key_prefix, __pyx_n_s_gevent_local_localimpl); __Pyx_GIVEREF(__pyx_n_s_gevent_local_localimpl);
173:
174: # The overall structure is as follows:
175: # For each local() object:
176: # greenlet.__dict__[key_prefix + str(id(local))]
177: # => _localimpl.dicts[id(greenlet)] => (ref(greenlet), {})
178:
179: # That final tuple is actually a localimpl_dict_entry object.
180:
+181: def all_local_dicts_for_greenlet(greenlet):
static PyObject *__pyx_pw_6gevent_14_gevent_clocal_1all_local_dicts_for_greenlet(PyObject *__pyx_self, PyObject *__pyx_v_greenlet); /*proto*/ static PyObject *__pyx_f_6gevent_14_gevent_clocal_all_local_dicts_for_greenlet(PyGreenlet *__pyx_v_greenlet, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_result = 0; struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *__pyx_v_local_impl = 0; struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal.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_14_gevent_clocal_1all_local_dicts_for_greenlet(PyObject *__pyx_self, PyObject *__pyx_v_greenlet); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_clocal_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_14_gevent_clocal_1all_local_dicts_for_greenlet = {"all_local_dicts_for_greenlet", (PyCFunction)__pyx_pw_6gevent_14_gevent_clocal_1all_local_dicts_for_greenlet, METH_O, __pyx_doc_6gevent_14_gevent_clocal_all_local_dicts_for_greenlet}; static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_greenlet, 1, "greenlet", 0))) __PYX_ERR(0, 181, __pyx_L1_error) __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_all_local_dicts_for_greenlet(__pyx_self, ((PyGreenlet *)__pyx_v_greenlet)); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_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_14_gevent_clocal_all_local_dicts_for_greenlet(__pyx_v_greenlet, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_clocal.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, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_clocal_1all_local_dicts_for_greenlet, 0, __pyx_n_s_all_local_dicts_for_greenlet, NULL, __pyx_n_s_gevent__gevent_clocal, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_all_local_dicts_for_greenlet, __pyx_t_2) < 0) __PYX_ERR(0, 181, __pyx_L1_error) __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, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 181, __pyx_L1_error)
182: """
183: Internal debug helper for getting the local values associated
184: with a greenlet. This is subject to change or removal at any time.
185:
186: :return: A list of ((type, id), {}) pairs, where the first element
187: is the type and id of the local object and the second object is its
188: instance dictionary, as seen from this greenlet.
189:
190: .. versionadded:: 1.3a2
191: """
192:
+193: result = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+194: 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, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_id_greenlet = __pyx_t_1; __pyx_t_1 = 0;
+195: 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, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(0, 195, __pyx_L1_error) __pyx_v_greenlet_dict = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+196: 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, 196, __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, 196, __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, 196, __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) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_5))) __PYX_ERR(0, 196, __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;
+197: 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, 197, __pyx_L1_error) } __pyx_t_8 = __Pyx_PyStr_Tailmatch(__pyx_v_k, __pyx_v_6gevent_14_gevent_clocal_key_prefix, 0, PY_SSIZE_T_MAX, -1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 197, __pyx_L1_error) __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0); if (__pyx_t_9) { /* … */ }
+198: continue
goto __pyx_L3_continue;
+199: 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, 199, __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_14_gevent_clocal__localimpl))))) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_local_impl, ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *)__pyx_t_6)); __pyx_t_6 = 0;
+200: 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) { /* … */ }
+201: continue
goto __pyx_L3_continue;
+202: 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, 202, __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, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6gevent_14_gevent_clocal__localimpl_dict_entry))))) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_entry, ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *)__pyx_t_6)); __pyx_t_6 = 0;
+203: if entry is None:
__pyx_t_8 = (((PyObject *)__pyx_v_entry) == Py_None); __pyx_t_9 = (__pyx_t_8 != 0); if (__pyx_t_9) { /* … */ }
204: # Not yet used in this greenlet.
+205: continue
goto __pyx_L3_continue;
+206: 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_7 = 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_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, 206, __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; __pyx_t_8 = (__pyx_t_9 != 0); if (unlikely(!__pyx_t_8)) { __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); __PYX_ERR(0, 206, __pyx_L1_error) } } #else if ((1)); else __PYX_ERR(0, 206, __pyx_L1_error) #endif
+207: result.append((local_impl.localtypeid, entry.localdict))
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __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_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_L3_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
208:
+209: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
210:
211:
212: class _wrefdict(dict):
213: """A dict that can be weak referenced"""
214:
215: class _greenlet_deleted(object):
216: """
217: A weakref callback for when the greenlet
218: is deleted.
219:
220: If the greenlet is a `gevent.greenlet.Greenlet` and
221: supplies ``rawlink``, that will be used instead of a
222: weakref.
223: """
+224: __slots__ = ('idt', 'wrdicts')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__greenlet_deleted->tp_dict, __pyx_n_s_slots, __pyx_tuple__4) < 0) __PYX_ERR(0, 224, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal__greenlet_deleted); /* … */ __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_idt, __pyx_n_s_wrdicts); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4);
225:
+226: def __init__(self, idt, wrdicts):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_17_greenlet_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 226, __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, 226, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 226, __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, 226, __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, 226, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._greenlet_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_17_greenlet_deleted___init__(((struct __pyx_obj_6gevent_14_gevent_clocal__greenlet_deleted *)__pyx_v_self), __pyx_v_idt, __pyx_v_wrdicts); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_clocal_17_greenlet_deleted___init__(struct __pyx_obj_6gevent_14_gevent_clocal__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; }
+227: 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;
+228: 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;
229:
+230: def __call__(self, _unused):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_17_greenlet_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 230, __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, 230, __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, 230, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._greenlet_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_17_greenlet_deleted_2__call__(((struct __pyx_obj_6gevent_14_gevent_clocal__greenlet_deleted *)__pyx_v_self), __pyx_v__unused); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_17_greenlet_deleted_2__call__(struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._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; }
+231: 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, 231, __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;
+232: if dicts:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_dicts); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 232, __pyx_L1_error) if (__pyx_t_5) { /* … */ }
+233: 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, 233, __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[3] = {__pyx_t_3, __pyx_v_self->idt, Py_None}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __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;
234:
235: class _local_deleted(object):
+236: __slots__ = ('key', 'wrthread', 'greenlet_deleted')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__local_deleted->tp_dict, __pyx_n_s_slots, __pyx_tuple__5) < 0) __PYX_ERR(0, 236, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal__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, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5);
237:
+238: def __init__(self, key, wrthread, greenlet_deleted):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_14_local_deleted_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 238, __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, 238, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 238, __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, 238, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 238, __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, 238, __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, 238, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._local_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_14_local_deleted___init__(((struct __pyx_obj_6gevent_14_gevent_clocal__local_deleted *)__pyx_v_self), __pyx_v_key, __pyx_v_wrthread, __pyx_v_greenlet_deleted); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_clocal_14_local_deleted___init__(struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._local_deleted.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+239: self.key = key
if (!(likely(PyString_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_key))) __PYX_ERR(0, 239, __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;
+240: 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;
+241: self.greenlet_deleted = greenlet_deleted
if (!(likely(((__pyx_v_greenlet_deleted) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_greenlet_deleted, __pyx_ptype_6gevent_14_gevent_clocal__greenlet_deleted))))) __PYX_ERR(0, 241, __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_14_gevent_clocal__greenlet_deleted *)__pyx_t_1); __pyx_t_1 = 0;
242:
+243: def __call__(self, _unused):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_14_local_deleted_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 243, __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, 243, __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, 243, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._local_deleted.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_14_local_deleted_2__call__(((struct __pyx_obj_6gevent_14_gevent_clocal__local_deleted *)__pyx_v_self), __pyx_v__unused); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_14_local_deleted_2__call__(struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._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; }
+244: 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, 244, __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;
+245: if thread is not None:
__pyx_t_5 = (__pyx_v_thread != Py_None); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+246: 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:; }
+247: unlink = thread.unlink
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_thread, __pyx_n_s_unlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_unlink = __pyx_t_1; __pyx_t_1 = 0;
+248: except AttributeError:
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); if (__pyx_t_4) { __Pyx_ErrRestore(0,0,0); goto __pyx_L5_exception_handled; } goto __pyx_L6_except_error; __pyx_L6_except_error:;
249: pass
250: else:
+251: unlink(self.greenlet_deleted)
/*else:*/ { __Pyx_INCREF(__pyx_v_unlink); __pyx_t_2 = __pyx_v_unlink; __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, ((PyObject *)__pyx_v_self->greenlet_deleted)}; __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, 251, __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;
+252: 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, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((PyObject_DelItem(__pyx_t_1, __pyx_v_self->key) < 0))) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
253:
254: class _localimpl(object):
255: """A class managing thread-local dicts"""
+256: __slots__ = ('key', 'dicts',
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__localimpl->tp_dict, __pyx_n_s_slots, __pyx_tuple__6) < 0) __PYX_ERR(0, 256, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal__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, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6);
257: 'localargs', 'localkwargs',
258: 'localtypeid',
259: '__weakref__',)
260:
+261: def __init__(self, args, kwargs, local_type, id_local):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_10_localimpl_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 261, __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, 261, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 261, __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, 261, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 261, __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, 261, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 261, __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, 261, __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, 261, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._localimpl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_10_localimpl___init__(((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, __pyx_v_local_type, __pyx_v_id_local); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_clocal_10_localimpl___init__(struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._localimpl.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_greenlet); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+262: 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, 262, __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, 262, __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_14_gevent_clocal_key_prefix, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __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) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 262, __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;
263: # { id(greenlet) -> _localimpl_dict_entry(ref(greenlet), greenlet-local dict) }
+264: self.dicts = _wrefdict()
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__wrefdict)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __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;
+265: self.localargs = args
if (!(likely(PyTuple_CheckExact(__pyx_v_args))||((__pyx_v_args) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v_args))) __PYX_ERR(0, 265, __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;
+266: self.localkwargs = kwargs
if (!(likely(PyDict_CheckExact(__pyx_v_kwargs))||((__pyx_v_kwargs) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_kwargs))) __PYX_ERR(0, 266, __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;
+267: self.localtypeid = local_type, id_local
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __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;
268:
269: # We need to create the thread dict in anticipation of
270: # __init__ being called, to make sure we don't call it
271: # again ourselves. MUST do this before setting any attributes.
+272: greenlet = getcurrent() # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_clocal_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_greenlet = ((PyGreenlet *)__pyx_t_1); __pyx_t_1 = 0;
+273: _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, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_6gevent_14_gevent_clocal__localimpl_create_dict(__pyx_v_self, __pyx_v_greenlet, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __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;
274:
275: class _localimpl_dict_entry(object):
276: """
277: The object that goes in the ``dicts`` of ``_localimpl``
278: object for each thread.
279: """
280: # This is a class, not just a tuple, so that cython can optimize
281: # attribute access
+282: __slots__ = ('wrgreenlet', 'localdict')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__localimpl_dict_entry->tp_dict, __pyx_n_s_slots, __pyx_tuple__7) < 0) __PYX_ERR(0, 282, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal__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, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7);
283:
+284: def __init__(self, wrgreenlet, localdict):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_21_localimpl_dict_entry_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 284, __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, 284, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 284, __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, 284, __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, 284, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_clocal._localimpl_dict_entry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_21_localimpl_dict_entry___init__(((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *)__pyx_v_self), __pyx_v_wrgreenlet, __pyx_v_localdict); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_clocal_21_localimpl_dict_entry___init__(struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._localimpl_dict_entry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+285: 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;
+286: self.localdict = localdict
if (!(likely(PyDict_CheckExact(__pyx_v_localdict))||((__pyx_v_localdict) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v_localdict))) __PYX_ERR(0, 286, __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;
287:
288: # We use functions instead of methods so that they can be cdef'd in
289: # local.pxd; if they were cdef'd as methods, they would cause
290: # the creation of a pointer and a vtable. This happens
291: # even if we declare the class @cython.final. functions thus save memory overhead
292: # (but not pointer chasing overhead; the vtable isn't used when we declare
293: # the class final).
294:
295:
+296: def _localimpl_create_dict(self, greenlet, id_greenlet):
static PyObject *__pyx_f_6gevent_14_gevent_clocal__localimpl_create_dict(struct __pyx_obj_6gevent_14_gevent_clocal__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_14_gevent_clocal__greenlet_deleted *__pyx_v_greenlet_deleted = 0; struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal._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; }
297: """Create a new dict for the current thread, and return it."""
+298: localdict = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_localdict = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+299: 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;
300:
+301: wrdicts = ref(self.dicts)
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_clocal_ref); __pyx_t_2 = __pyx_v_6gevent_14_gevent_clocal_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, 301, __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;
302:
303: # When the greenlet is deleted, remove the local dict.
304: # Note that this is suboptimal if the greenlet object gets
305: # caught in a reference loop. We would like to be called
306: # as soon as the OS-level greenlet ends instead.
307:
308: # If we are working with a gevent.greenlet.Greenlet, we
309: # can pro-actively clear out with a link, avoiding the
310: # issue described above. Use rawlink to avoid spawning any
311: # more greenlets.
+312: greenlet_deleted = _greenlet_deleted(id_greenlet, wrdicts)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __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_14_gevent_clocal__greenlet_deleted), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __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_14_gevent_clocal__greenlet_deleted *)__pyx_t_2); __pyx_t_2 = 0;
313:
+314: 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, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_rawlink = __pyx_t_2; __pyx_t_2 = 0;
+315: 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; }
+316: rawlink(greenlet_deleted)
__Pyx_INCREF(__pyx_v_rawlink); __pyx_t_1 = __pyx_v_rawlink; __pyx_t_3 = NULL; __pyx_t_4 = 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_4 = 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_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __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;
+317: wrthread = ref(greenlet)
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_clocal_ref); __pyx_t_1 = __pyx_v_6gevent_14_gevent_clocal_ref; __pyx_t_3 = NULL; __pyx_t_4 = 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_4 = 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_4, 1+__pyx_t_4); __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;
318: else:
+319: wrthread = ref(greenlet, greenlet_deleted)
/*else*/ { __Pyx_INCREF(__pyx_v_6gevent_14_gevent_clocal_ref); __pyx_t_1 = __pyx_v_6gevent_14_gevent_clocal_ref; __pyx_t_3 = NULL; __pyx_t_4 = 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_4 = 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_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __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:;
320:
321:
322: # When the localimpl is deleted, remove the thread attribute.
+323: local_deleted = _local_deleted(key, wrthread, greenlet_deleted)
__pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __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_14_gevent_clocal__local_deleted), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __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_14_gevent_clocal__local_deleted *)__pyx_t_1); __pyx_t_1 = 0;
324:
325:
+326: wrlocal = ref(self, local_deleted)
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_clocal_ref); __pyx_t_2 = __pyx_v_6gevent_14_gevent_clocal_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[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_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __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;
+327: 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, 327, __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, 327, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
328:
+329: self.dicts[id_greenlet] = _localimpl_dict_entry(wrthread, localdict)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __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_14_gevent_clocal__localimpl_dict_entry), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __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, 329, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_self->dicts, __pyx_v_id_greenlet, __pyx_t_2) < 0))) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+330: return localdict
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_localdict); __pyx_r = __pyx_v_localdict; goto __pyx_L0;
331:
332:
+333: _marker = object()
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_clocal__marker); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_clocal__marker, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
334:
+335: def _local_get_dict(self):
static CYTHON_INLINE PyObject *__pyx_f_6gevent_14_gevent_clocal__local_get_dict(struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_v_self) { struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *__pyx_v_impl = 0; PyObject *__pyx_v_dct = 0; struct __pyx_obj_6gevent_14_gevent_clocal__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_XDECREF(__pyx_t_10); __Pyx_AddTraceback("gevent._gevent_clocal._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; }
+336: 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_14_gevent_clocal__localimpl *)__pyx_t_1);
__pyx_t_1 = 0;
337: # Cython can optimize dict[], but not dict.get()
+338: greenlet = getcurrent() # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_clocal_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_greenlet = ((PyGreenlet *)__pyx_t_1); __pyx_t_1 = 0;
+339: idg = id(greenlet)
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_greenlet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_idg = __pyx_t_1; __pyx_t_1 = 0;
+340: 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:; }
+341: entry = impl.dicts[idg]
if (unlikely(__pyx_v_impl->dicts == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 341, __pyx_L3_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_impl->dicts, __pyx_v_idg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_14_gevent_clocal__localimpl_dict_entry))))) __PYX_ERR(0, 341, __pyx_L3_error) __pyx_v_entry = ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *)__pyx_t_1); __pyx_t_1 = 0;
+342: 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;
+343: except KeyError:
__pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_5) { __Pyx_AddTraceback("gevent._gevent_clocal._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, 343, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7);
+344: dct = _localimpl_create_dict(impl, greenlet, idg)
__pyx_t_8 = __pyx_f_6gevent_14_gevent_clocal__localimpl_create_dict(__pyx_v_impl, __pyx_v_greenlet, __pyx_v_idg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_dct, ((PyObject*)__pyx_t_8)); __pyx_t_8 = 0;
+345: 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, 345, __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, 345, __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, 345, __pyx_L5_except_error) } __pyx_t_9 = PyDict_Copy(__pyx_v_impl->localkwargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 345, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_v_impl->localargs, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 345, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_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:;
+346: return dct
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dct); __pyx_r = __pyx_v_dct; goto __pyx_L0;
347:
+348: def _init():
static void __pyx_f_6gevent_14_gevent_clocal__init(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+349: greenlet_init() # pylint:disable=undefined-variable
__pyx_f_6gevent_14_gevent_clocal_greenlet_init();
350:
351: _local_attrs = {
+352: '_local__impl',
__pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PySet_Add(__pyx_t_2, __pyx_n_s_local__impl) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_get_descriptors) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_set_or_del_descripto) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_del_descriptors) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_set_descriptors) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_2) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_local_type_vars) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_class) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_cinit) < 0) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_clocal__local_attrs); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_clocal__local_attrs, ((PyObject*)__pyx_t_2)); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
353: '_local_type_get_descriptors',
354: '_local_type_set_or_del_descriptors',
355: '_local_type_del_descriptors',
356: '_local_type_set_descriptors',
357: '_local_type',
358: '_local_type_vars',
359: '__class__',
360: '__cinit__',
361: }
362:
+363: class local(object):
struct __pyx_vtabstruct_6gevent_14_gevent_clocal_local { struct __pyx_obj_6gevent_14_gevent_clocal_local *(*__pyx___copy__)(struct __pyx_obj_6gevent_14_gevent_clocal_local *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_6gevent_14_gevent_clocal_local *__pyx_vtabptr_6gevent_14_gevent_clocal_local;
364: """
365: An object whose attributes are greenlet-local.
366: """
+367: __slots__ = tuple(_local_attrs - {'__class__', '__cinit__'})
__pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PySet_Add(__pyx_t_2, __pyx_n_s_class) < 0) __PYX_ERR(0, 367, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_s_cinit) < 0) __PYX_ERR(0, 367, __pyx_L1_error) __pyx_t_1 = PyNumber_Subtract(__pyx_v_6gevent_14_gevent_clocal__local_attrs, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __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, 367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local->tp_dict, __pyx_n_s_slots, __pyx_t_2) < 0) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal_local);
368:
+369: def __cinit__(self, *args, **kw):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_5local_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local___cinit__(((struct __pyx_obj_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local___cinit__(struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kw) { struct __pyx_obj_6gevent_14_gevent_clocal__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._gevent_clocal.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; }
+370: 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, 370, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+371: if type(self).__init__ == object.__init__: # pylint:disable=comparison-with-callable
__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, 371, __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, 371, __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, 371, __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, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_1)) { /* … */ }
+372: raise TypeError("Initialization arguments are not supported", args, kw)
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __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, 372, __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, 372, __pyx_L1_error)
+373: 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, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __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_14_gevent_clocal__localimpl), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_impl = ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *)__pyx_t_4); __pyx_t_4 = 0;
374: # pylint:disable=attribute-defined-outside-init
+375: 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;
+376: get, dels, sets_or_dels, sets = _local_find_descriptors(self)
__pyx_t_4 = __pyx_f_6gevent_14_gevent_clocal__local_find_descriptors(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __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, 376, __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, 376, __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, 376, __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;
+377: self._local_type_get_descriptors = get
if (!(likely(PySet_CheckExact(__pyx_v_get))||((__pyx_v_get) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_v_get))) __PYX_ERR(0, 377, __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;
+378: 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) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_v_sets_or_dels))) __PYX_ERR(0, 378, __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;
+379: self._local_type_del_descriptors = dels
if (!(likely(PySet_CheckExact(__pyx_v_dels))||((__pyx_v_dels) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_v_dels))) __PYX_ERR(0, 379, __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;
+380: self._local_type_set_descriptors = sets
if (!(likely(PySet_CheckExact(__pyx_v_sets))||((__pyx_v_sets) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_v_sets))) __PYX_ERR(0, 380, __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;
+381: 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))));
+382: 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, 382, __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, 382, __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;
383:
+384: def __getattribute__(self, name): # pylint:disable=too-many-return-statements
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_5local_3__getattribute__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local_2__getattribute__(((struct __pyx_obj_6gevent_14_gevent_clocal_local *)__pyx_v_self), ((PyObject *)__pyx_v_name)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_5local_2__getattribute__(struct __pyx_obj_6gevent_14_gevent_clocal_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._gevent_clocal.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; }
+385: if name in _local_attrs:
if (unlikely(__pyx_v_6gevent_14_gevent_clocal__local_attrs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 385, __pyx_L1_error) } __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_6gevent_14_gevent_clocal__local_attrs, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 385, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
386: # The _local__impl, __cinit__, etc, won't be hit by the
387: # Cython version, if we've done things right. If we haven't,
388: # they will be, and this will produce an error.
+389: 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, 389, __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, 389, __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;
390:
+391: dct = _local_get_dict(self)
__pyx_t_3 = __pyx_f_6gevent_14_gevent_clocal__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_dct = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
392:
+393: 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, 393, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+394: return dct
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_dct); __pyx_r = __pyx_v_dct; goto __pyx_L0;
395: # If there's no possible way we can switch, because this
396: # attribute is *not* found in the class where it might be a
397: # data descriptor (property), and it *is* in the dict
398: # then we don't need to swizzle the dict and take the lock.
399:
400: # We don't have to worry about people overriding __getattribute__
401: # because if they did, the dict-swizzling would only last as
402: # long as we were in here anyway.
403: # Similarly, a __getattr__ will still be called by _oga() if needed
404: # if it's not in the dict.
405:
406: # Optimization: If we're not subclassed, then
407: # there can be no descriptors except for methods, which will
408: # never need to use __dict__.
+409: if self._local_type is local:
__pyx_t_2 = (__pyx_v_self->_local_type == __pyx_ptype_6gevent_14_gevent_clocal_local); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+410: 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, 410, __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, 410, __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, 410, __pyx_L1_error) } __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __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, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = NULL; __pyx_t_6 = 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_6 = 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_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __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;
411:
412: # NOTE: If this is a descriptor, this will invoke its __get__.
413: # A broken descriptor that doesn't return itself when called with
414: # a None for the instance argument could mess us up here.
415: # But this is faster than a loop over mro() checking each class __dict__
416: # manually.
+417: if name in dct:
if (unlikely(__pyx_v_dct == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 417, __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, 417, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+418: 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, 418, __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, 418, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
419: # If there is a dict value, and nothing in the type,
420: # it can't possibly be a descriptor, so it is just returned.
+421: 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, 421, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
422:
423: # It's in the type *and* in the dict. If the type value is
424: # a data descriptor (defines __get__ *and* either __set__ or
425: # __delete__), then the type wins. If it's a non-data descriptor
426: # (defines just __get__), then the instance wins. If it's not a
427: # descriptor at all (doesn't have __get__), the instance wins.
428: # NOTE that the docs for descriptors say that these methods must be
429: # defined on the *class* of the object in the type.
+430: 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, 430, __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, 430, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
431: # Entirely not a descriptor. Instance wins.
+432: 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, 432, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+433: 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, 433, __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, 433, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
434: # A data descriptor.
435: # arbitrary code execution while these run. If they touch self again,
436: # they'll call back into us and we'll repeat the dance.
+437: 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, 437, __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;
+438: 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, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; __pyx_t_6 = 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_6 = 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_6, 3+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __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;
439: # Last case is a non-data descriptor. Instance wins.
+440: 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, 440, __pyx_L1_error) } __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_dct, __pyx_v_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
441:
+442: 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, 442, __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, 442, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
443: # Not in the dictionary, but is found in the type. It could be
444: # a non-data descriptor still. Some descriptors, like @staticmethod,
445: # return objects (functions, in this case), that are *themselves*
446: # descriptors, which when invoked, again, would do the wrong thing.
447: # So we can't rely on getattr() on the type for them, we have to
448: # look through the MRO dicts ourself.
+449: 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, 449, __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, 449, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
450: # Not a descriptor, can't execute code. So all we need is
451: # the return value of getattr() on our type.
+452: 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, 452, __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;
453:
+454: 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, 454, __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[1] = {__pyx_t_5, }; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __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_8 = 0; __pyx_t_9 = NULL; } else { __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 454, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_8 >= 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_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 454, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_8 >= 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_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 454, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_9(__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, 454, __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;
+455: bd = base.__dict__
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_bd, __pyx_t_3); __pyx_t_3 = 0;
+456: 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, 456, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+457: 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, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_attr_on_type = __pyx_t_3; __pyx_t_3 = 0;
+458: 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, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = NULL; __pyx_t_6 = 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_6 = 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_6, 3+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __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;
+459: 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;
460:
461: # It wasn't in the dict and it wasn't in the type.
462: # So the next step is to invoke type(self)__getattr__, if it
463: # exists, otherwise raise an AttributeError.
464: # we will invoke type(self).__getattr__ or raise an attribute error.
+465: 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, 465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+466: 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, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; __pyx_t_6 = 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_6 = 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_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; 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; } __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+467: 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, 467, __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, 467, __pyx_L1_error)
+468: % (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, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 468, __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, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
469:
+470: def __setattr__(self, name, value):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_5local_5__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local_4__setattr__(((struct __pyx_obj_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local_4__setattr__(struct __pyx_obj_6gevent_14_gevent_clocal_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._gevent_clocal.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; }
+471: 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, 471, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+472: raise AttributeError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __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, 472, __pyx_L1_error)
473: "%r object attribute '__dict__' is read-only"
+474: % 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, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
475:
+476: if name in _local_attrs:
if (unlikely(__pyx_v_6gevent_14_gevent_clocal__local_attrs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 476, __pyx_L1_error) } __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_v_name, __pyx_v_6gevent_14_gevent_clocal__local_attrs, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 476, __pyx_L1_error) __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ }
+477: 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, 477, __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, 477, __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;
+478: return
__pyx_r = 0; goto __pyx_L0;
479:
+480: dct = _local_get_dict(self)
__pyx_t_3 = __pyx_f_6gevent_14_gevent_clocal__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_dct = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
481:
+482: if self._local_type is local:
__pyx_t_4 = (__pyx_v_self->_local_type == __pyx_ptype_6gevent_14_gevent_clocal_local); __pyx_t_1 = (__pyx_t_4 != 0); if (__pyx_t_1) { /* … */ }
483: # Optimization: If we're not subclassed, we can't
484: # have data descriptors, so this goes right in the dict.
+485: dct[name] = value
if (unlikely(__pyx_v_dct == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 485, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_dct, __pyx_v_name, __pyx_v_value) < 0))) __PYX_ERR(0, 485, __pyx_L1_error)
+486: return
__pyx_r = 0; goto __pyx_L0;
487:
+488: 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, 488, __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, 488, __pyx_L1_error) __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ }
+489: 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, 489, __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, 489, __pyx_L1_error) __pyx_t_1 = (__pyx_t_4 != 0); if (__pyx_t_1) { /* … */ }
+490: 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_14_gevent_clocal__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, 490, __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;
491: # A data descriptor, like a property or a slot.
+492: 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, 492, __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[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_6, 3+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __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;
+493: return
__pyx_r = 0; goto __pyx_L0;
494: # Otherwise it goes directly in the dict
+495: dct[name] = value
if (unlikely(__pyx_v_dct == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 495, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_dct, __pyx_v_name, __pyx_v_value) < 0))) __PYX_ERR(0, 495, __pyx_L1_error)
496:
+497: def __delattr__(self, name):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_clocal_5local_7__delattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static int __pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local_6__delattr__(((struct __pyx_obj_6gevent_14_gevent_clocal_local *)__pyx_v_self), ((PyObject *)__pyx_v_name)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_clocal_5local_6__delattr__(struct __pyx_obj_6gevent_14_gevent_clocal_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_10); __Pyx_AddTraceback("gevent._gevent_clocal.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; }
+498: 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, 498, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+499: raise AttributeError(
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_t_2); 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_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 499, __pyx_L1_error)
500: "%r object attribute '__dict__' is read-only"
+501: % 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, 501, __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, 501, __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, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
502:
+503: 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, 503, __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, 503, __pyx_L1_error) __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ }
+504: 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, 504, __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, 504, __pyx_L1_error) __pyx_t_1 = (__pyx_t_4 != 0); if (__pyx_t_1) { /* … */ }
505: # A data descriptor, like a property or a slot.
+506: 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_14_gevent_clocal__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, 506, __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;
+507: 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, 507, __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, 507, __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;
+508: return
__pyx_r = 0; goto __pyx_L0;
509: # Otherwise it goes directly in the dict
510:
511: # Begin inlined function _get_dict()
+512: dct = _local_get_dict(self)
__pyx_t_5 = __pyx_f_6gevent_14_gevent_clocal__local_get_dict(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_dct = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
513:
+514: 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:; }
+515: del dct[name]
if (unlikely(__pyx_v_dct == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 515, __pyx_L6_error) } if (unlikely((PyDict_DelItem(__pyx_v_dct, __pyx_v_name) < 0))) __PYX_ERR(0, 515, __pyx_L6_error)
+516: except KeyError:
__pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { __Pyx_AddTraceback("gevent._gevent_clocal.local.__delattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 516, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
+517: raise AttributeError(name)
__pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 517, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(0, 517, __pyx_L8_except_error) } goto __pyx_L8_except_error; __pyx_L8_except_error:;
518:
+519: def __copy__(self):
static PyObject *__pyx_pw_6gevent_14_gevent_clocal_5local_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_f_6gevent_14_gevent_clocal_5local___copy__(struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_v_self, int __pyx_skip_dispatch) { struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *__pyx_v_entry = 0; PyObject *__pyx_v_dct = 0; PyObject *__pyx_v_duplicate = 0; struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_v_instance = 0; struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *__pyx_v_impl = NULL; PyTypeObject *__pyx_v_cls = NULL; struct __pyx_obj_6gevent_14_gevent_clocal_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) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (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_typedict_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, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #ifdef __Pyx_CyFunction_USED if (!__Pyx_IsCyOrPyCFunction(__pyx_t_1) #else if (!PyCFunction_Check(__pyx_t_1) #endif || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_14_gevent_clocal_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, 519, __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_14_gevent_clocal_local))))) __PYX_ERR(0, 519, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6gevent_14_gevent_clocal_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_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_clocal.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_14_gevent_clocal_5local_9__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_clocal_5local_8__copy__, "local.__copy__(self) -> local"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_clocal_5local_9__copy__ = {"__copy__", (PyCFunction)__pyx_pw_6gevent_14_gevent_clocal_5local_9__copy__, METH_NOARGS, __pyx_doc_6gevent_14_gevent_clocal_5local_8__copy__}; static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local_8__copy__(((struct __pyx_obj_6gevent_14_gevent_clocal_local *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_5local_8__copy__(struct __pyx_obj_6gevent_14_gevent_clocal_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_14_gevent_clocal_5local___copy__(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_clocal.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, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_clocal_5local_9__copy__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_local___copy, NULL, __pyx_n_s_gevent__gevent_clocal, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local->tp_dict, __pyx_n_s_copy, __pyx_t_2) < 0) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_clocal_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, 519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 519, __pyx_L1_error)
+520: 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_14_gevent_clocal__localimpl *)__pyx_t_1);
__pyx_t_1 = 0;
+521: 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, 521, __pyx_L1_error) } __pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_clocal_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __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, 521, __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, 521, __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_14_gevent_clocal__localimpl_dict_entry))))) __PYX_ERR(0, 521, __pyx_L1_error) __pyx_v_entry = ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *)__pyx_t_1); __pyx_t_1 = 0;
522:
+523: 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;
+524: duplicate = copy(dct)
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_clocal_copy); __pyx_t_2 = __pyx_v_6gevent_14_gevent_clocal_copy; __pyx_t_3 = NULL; __pyx_t_5 = 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_5 = 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_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __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) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(0, 524, __pyx_L1_error) __pyx_v_duplicate = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
525:
+526: cls = type(self)
__Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
__pyx_v_cls = ((PyTypeObject*)((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+527: 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, 527, __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, 527, __pyx_L1_error) } __pyx_t_1 = PyDict_Copy(__pyx_v_impl->localkwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_v_impl->localargs, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6gevent_14_gevent_clocal_local))))) __PYX_ERR(0, 527, __pyx_L1_error) __pyx_v_instance = ((struct __pyx_obj_6gevent_14_gevent_clocal_local *)__pyx_t_2); __pyx_t_2 = 0;
+528: _local__copy_dict_from(instance, impl, duplicate)
__pyx_t_2 = __pyx_f_6gevent_14_gevent_clocal__local__copy_dict_from(__pyx_v_instance, __pyx_v_impl, __pyx_v_duplicate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+529: return instance
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_instance); __pyx_r = __pyx_v_instance; goto __pyx_L0;
530:
+531: def _local__copy_dict_from(self, impl, duplicate):
static PyObject *__pyx_f_6gevent_14_gevent_clocal__local__copy_dict_from(struct __pyx_obj_6gevent_14_gevent_clocal_local *__pyx_v_self, struct __pyx_obj_6gevent_14_gevent_clocal__localimpl *__pyx_v_impl, PyObject *__pyx_v_duplicate) { struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *__pyx_v_entry = 0; PyGreenlet *__pyx_v_current = NULL; PyObject *__pyx_v_currentId = NULL; struct __pyx_obj_6gevent_14_gevent_clocal__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_4); __Pyx_AddTraceback("gevent._gevent_clocal._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; }
+532: current = getcurrent() # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_clocal_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_current = ((PyGreenlet *)__pyx_t_1); __pyx_t_1 = 0;
+533: currentId = id(current)
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_current)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_currentId = __pyx_t_1; __pyx_t_1 = 0;
+534: 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_14_gevent_clocal__localimpl *)__pyx_t_1);
__pyx_t_1 = 0;
+535: assert new_impl is not impl
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = (__pyx_v_new_impl != __pyx_v_impl); __pyx_t_3 = (__pyx_t_2 != 0); if (unlikely(!__pyx_t_3)) { __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0); __PYX_ERR(0, 535, __pyx_L1_error) } } #else if ((1)); else __PYX_ERR(0, 535, __pyx_L1_error) #endif
+536: 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, 536, __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, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_14_gevent_clocal__localimpl_dict_entry))))) __PYX_ERR(0, 536, __pyx_L1_error) __pyx_v_entry = ((struct __pyx_obj_6gevent_14_gevent_clocal__localimpl_dict_entry *)__pyx_t_1); __pyx_t_1 = 0;
+537: new_impl.dicts[currentId] = _localimpl_dict_entry(entry.wrgreenlet, duplicate)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __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_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal__localimpl_dict_entry), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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, 537, __pyx_L1_error) } if (unlikely((PyDict_SetItem(__pyx_v_new_impl->dicts, __pyx_v_currentId, __pyx_t_4) < 0))) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
538:
+539: def _local_find_descriptors(self):
static PyObject *__pyx_f_6gevent_14_gevent_clocal__local_find_descriptors(struct __pyx_obj_6gevent_14_gevent_clocal_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._gevent_clocal._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; }
+540: 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))));
+541: gets = 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_gets = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+542: dels = 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_dels = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+543: set_or_del = set()
__pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_set_or_del = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+544: sets = set()
__pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_sets = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+545: 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, 545, __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, 545, __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, 545, __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;
546:
+547: 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, 547, __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, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __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, 547, __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, 547, __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, 547, __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, 547, __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, 547, __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;
548: # Conventionally, descriptors when called on a class
549: # return themself, but not all do. Notable exceptions are
550: # in the zope.interface package, where things like __provides__
551: # return other class attributes. So we can't use getattr, and instead
552: # walk up the dicts
+553: 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, 553, __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, 553, __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;
+554: bd = base.__dict__
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_bd, __pyx_t_3); __pyx_t_3 = 0;
+555: 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, 555, __pyx_L1_error) __pyx_t_9 = (__pyx_t_8 != 0); if (__pyx_t_9) { /* … */ }
+556: 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, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_attr, __pyx_t_3); __pyx_t_3 = 0;
+557: break
goto __pyx_L6_break;
558: else:
+559: 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, 559, __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, 559, __pyx_L1_error) }
560:
+561: 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))));
+562: 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, 562, __pyx_L1_error) __pyx_t_8 = (__pyx_t_9 != 0); if (__pyx_t_8) { /* … */ }
+563: 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, 563, __pyx_L1_error)
+564: 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, 564, __pyx_L1_error) __pyx_t_9 = (__pyx_t_8 != 0); if (__pyx_t_9) { /* … */ }
+565: 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, 565, __pyx_L1_error)
+566: 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, 566, __pyx_L1_error)
+567: 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, 567, __pyx_L1_error) __pyx_t_8 = (__pyx_t_9 != 0); if (__pyx_t_8) { /* … */ }
+568: 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, 568, __pyx_L1_error)
569:
+570: 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, 570, __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;
571:
572: # Cython doesn't let us use __new__, it requires
573: # __cinit__. But we need __new__ if we're not compiled
574: # (e.g., on PyPy). So we set it at runtime. Cython
575: # will raise an error if we're compiled.
+576: def __new__(cls, *args, **kw):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_14_gevent_clocal_2__new__, "__new__(cls, *args, **kw)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_clocal_3__new__ = {"__new__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_clocal_3__new__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_clocal_2__new__}; static PyObject *__pyx_pw_6gevent_14_gevent_clocal_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_USE_MODULE_STATE 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, 576, __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, 576, __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, 576, __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._gevent_clocal.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_clocal_2__new__(__pyx_self, __pyx_v_cls, __pyx_v_args, __pyx_v_kw); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_DECREF(__pyx_v_args); __Pyx_DECREF(__pyx_v_kw); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_clocal_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_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._gevent_clocal.__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, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_clocal_3__new__, 0, __pyx_n_s_new, NULL, __pyx_n_s_gevent__gevent_clocal, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_new, __pyx_t_2) < 0) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+577: self = super(local, cls).__new__(cls)
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local); __Pyx_GIVEREF((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_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, 577, __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, 577, __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, 577, __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;
578: # We get the cls in *args for some reason
579: # too when we do it this way....except on PyPy3, which does
580: # not *unless* it's wrapped in a classmethod (which it is)
+581: 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, 581, __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, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyDict_Copy(__pyx_v_kw); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __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; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+582: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0;
583:
+584: if local.__module__ == 'gevent.local':
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_gevent_local, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L2; }
585: # PyPy2/3 and CPython handle adding a __new__ to the class
586: # in different ways. In CPython and PyPy3, it must be wrapped with classmethod;
587: # in PyPy2 < 7.3.3, it must not. In either case, the args that get passed to
588: # it are stil wrong.
589: #
590: # Prior to Python 3.10, Cython-compiled classes were immutable and
591: # raised a TypeError on assignment to __new__, and we relied on that
592: # to detect the compiled version; but that breaks in
593: # 3.10 as classes are now mutable. (See
594: # https://github.com/cython/cython/issues/4326).
595: #
596: # That's OK; post https://github.com/gevent/gevent/issues/1480, the Cython-compiled
597: # module has a different name than the pure-Python version and we can check for that.
598: # It's not as direct, but it works.
599: # So here we're not compiled
+600: from gevent._compat import PYPY
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_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, 600, __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_PYPY_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_PYPY_2, __pyx_t_2) < 0) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+601: from gevent._compat import PY2
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_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, 601, __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_PY2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_PY2, __pyx_t_1) < 0) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+602: if PYPY and PY2:
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PYPY_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PY2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __pyx_L4_bool_binop_done:; if (__pyx_t_3) { /* … */ goto __pyx_L3; }
603: # The behaviour changed with no warning between PyPy2 7.3.2 and 7.3.3.
+604: local.__new__ = __new__
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_new, __pyx_t_2) < 0) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+605: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L11_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_L11_try_end:; }
+606: local() # <= 7.3.2
__pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+607: except TypeError:
__pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_8) { __Pyx_AddTraceback("gevent._gevent_clocal", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 607, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_9);
608: # >= 7.3.3
+609: local.__new__ = classmethod(__new__)
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_new); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 609, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_classmethod, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 609, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_new, __pyx_t_11) < 0) __PYX_ERR(0, 609, __pyx_L8_except_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L7_exception_handled; } goto __pyx_L8_except_error; __pyx_L8_except_error:;
610: else:
+611: local.__new__ = classmethod(__new__)
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_new); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_classmethod, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_new, __pyx_t_1) < 0) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L3:;
612:
+613: del PYPY
if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PYPY_2) < 0) __PYX_ERR(0, 613, __pyx_L1_error)
+614: del PY2
if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_PY2) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
615: else: # pragma: no cover
616: # Make sure we revisit in case of changes to the (accelerator) module names.
+617: if local.__module__ != 'gevent._gevent_clocal':
/*else*/ { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_gevent__gevent_clocal, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { /* … */ } } __pyx_L2:;
+618: raise AssertionError("Module names changed (local: %r; __name__: %r); revisit this code" % (
__pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Module_names_changed_local_r___n, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AssertionError, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 618, __pyx_L1_error)
+619: local.__module__, __name__) )
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_14_gevent_clocal_local), __pyx_n_s_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); __pyx_t_1 = 0; __pyx_t_9 = 0;
620:
+621: _init()
__pyx_f_6gevent_14_gevent_clocal__init();
622:
+623: from gevent._util import import_c_accel
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_import_c_accel); __Pyx_GIVEREF(__pyx_n_s_import_c_accel); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_import_c_accel); __pyx_t_9 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+624: import_c_accel(globals(), 'gevent._local')
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_INCREF(__pyx_kp_s_gevent__local); __Pyx_GIVEREF(__pyx_kp_s_gevent__local); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_s_gevent__local); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;