Generated by Cython 3.0.0a11
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: _greenlet_primitives.c
+001: # -*- coding: utf-8 -*-
__pyx_t_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: # copyright (c) 2018 gevent. See LICENSE.
003: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
004: """
005: A collection of primitives used by the hub, and suitable for
006: compilation with Cython because of their frequency of use.
007:
008: """
009: from __future__ import absolute_import
010: from __future__ import division
011: from __future__ import print_function
012:
+013: from weakref import ref as wref
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __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_3 = __Pyx_Import(__pyx_n_s_weakref, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ref); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_INCREF(__pyx_t_2);__Pyx_XGOTREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref, __pyx_t_2);__Pyx_GIVEREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+014: from gc import get_objects
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_INCREF(__pyx_n_s_get_objects);__Pyx_GIVEREF(__pyx_n_s_get_objects);PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_get_objects);__pyx_t_2 = __Pyx_Import(__pyx_n_s_gc, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_objects); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_INCREF(__pyx_t_3);__Pyx_XGOTREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects, __pyx_t_3);__Pyx_GIVEREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
015:
+016: from greenlet import greenlet
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_INCREF(__pyx_n_s_greenlet);__Pyx_GIVEREF(__pyx_n_s_greenlet);PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_greenlet);__pyx_t_3 = __Pyx_Import(__pyx_n_s_greenlet, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
017:
+018: from gevent.exceptions import BlockingSwitchOutError
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_INCREF(__pyx_n_s_BlockingSwitchOutError);__Pyx_GIVEREF(__pyx_n_s_BlockingSwitchOutError);PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_BlockingSwitchOutError);__pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_exceptions, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BlockingSwitchOutError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_INCREF(__pyx_t_3);__Pyx_XGOTREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_BlockingSwitchOutError);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_BlockingSwitchOutError, __pyx_t_3);__Pyx_GIVEREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
019:
020:
021: # In Cython, we define these as 'cdef inline' functions. The
022: # compilation unit cannot have a direct assignment to them (import
023: # is assignment) without generating a 'lvalue is not valid target'
024: # error.
+025: locals()['getcurrent'] = __import__('greenlet').getcurrent
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);if (unlikely((PyDict_SetItem(__pyx_t_2, __pyx_n_s_getcurrent, __pyx_t_3) < 0))) __PYX_ERR(0, 25, __pyx_L1_error)__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 25, __pyx_L1_error)__Pyx_GOTREF(__pyx_tuple__3);__Pyx_GIVEREF(__pyx_tuple__3);
+026: locals()['greenlet_init'] = lambda: None
/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_6lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_6lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_6lambda, METH_NOARGS, 0};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_6lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("lambda (wrapper)", 0);__pyx_r = __pyx_lambda_funcdef_6gevent_29_gevent_c_greenlet_primitives_lambda(__pyx_self);/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_lambda_funcdef_6gevent_29_gevent_c_greenlet_primitives_lambda(CYTHON_UNUSED PyObject *__pyx_self) {PyObject *__pyx_r = NULL;__Pyx_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_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_6lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);if (unlikely((PyDict_SetItem(__pyx_t_2, __pyx_n_s_greenlet_init, __pyx_t_3) < 0))) __PYX_ERR(0, 26, __pyx_L1_error)__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+027: locals()['_greenlet_switch'] = greenlet.switch
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet), __pyx_n_s_switch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);if (unlikely((PyDict_SetItem(__pyx_t_2, __pyx_n_s_greenlet_switch, __pyx_t_3) < 0))) __PYX_ERR(0, 27, __pyx_L1_error)__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
028:
029:
+030: __all__ = [
__pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_INCREF(__pyx_n_s_TrackedRawGreenlet);__Pyx_GIVEREF(__pyx_n_s_TrackedRawGreenlet);PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_TrackedRawGreenlet);__Pyx_INCREF(__pyx_n_s_SwitchOutGreenletWithLoop);__Pyx_GIVEREF(__pyx_n_s_SwitchOutGreenletWithLoop);PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_SwitchOutGreenletWithLoop);if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_3) < 0) __PYX_ERR(0, 30, __pyx_L1_error)__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
031: 'TrackedRawGreenlet',
032: 'SwitchOutGreenletWithLoop',
033: ]
034:
035: class TrackedRawGreenlet(greenlet):
036:
+037: def __init__(self, function, parent):
/* Python wrapper */static int __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/static int __pyx_pw_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {PyObject *__pyx_v_function = 0;PyObject *__pyx_v_parent = 0;CYTHON_UNUSED 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_STATEPyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_parent,0};#elsestatic PyObject **__pyx_pyargnames[] = {&__pyx_n_s_function,&__pyx_n_s_parent,0};#endifPyObject* 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_function)) != 0)) kw_args--;else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __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_parent)) != 0)) kw_args--;else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L3_error)else {__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 37, __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, 37, __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_function = values[0];__pyx_v_parent = values[1];}goto __pyx_L4_argument_unpacking_done;__pyx_L5_argtuple_error:;__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 37, __pyx_L3_error)__pyx_L3_error:;__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);__Pyx_RefNannyFinishContext();return -1;__pyx_L4_argument_unpacking_done:;__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet___init__(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_TrackedRawGreenlet *)__pyx_v_self), __pyx_v_function, __pyx_v_parent);int __pyx_lineno = 0;const char *__pyx_filename = NULL;int __pyx_clineno = 0;/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static int __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_18TrackedRawGreenlet___init__(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_TrackedRawGreenlet *__pyx_v_self, PyObject *__pyx_v_function, PyObject *__pyx_v_parent) {PyGreenlet *__pyx_v_current = NULL;int __pyx_r;__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_XDECREF(__pyx_t_3);__Pyx_XDECREF(__pyx_t_8);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = -1;__pyx_L0:;__Pyx_XDECREF((PyObject *)__pyx_v_current);__Pyx_RefNannyFinishContext();return __pyx_r;}
+038: greenlet.__init__(self, function, parent)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __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[4] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_function, __pyx_v_parent};__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __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;
039: # See greenlet.py's Greenlet class. We capture the cheap
040: # parts to maintain the tree structure, but we do not capture
041: # the stack because that's too expensive for 'spawn_raw'.
042:
+043: current = getcurrent() # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_29_gevent_c_greenlet_primitives_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_v_current = ((PyGreenlet *)__pyx_t_1);__pyx_t_1 = 0;
+044: self.spawning_greenlet = wref(current)
__Pyx_INCREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref);__pyx_t_2 = __pyx_v_6gevent_29_gevent_c_greenlet_primitives_wref; __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, ((PyObject *)__pyx_v_current)};__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, 44, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;}if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_spawning_greenlet, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error)__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
045: # See Greenlet for how trees are maintained.
+046: try:
{/*try:*/ {}__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;goto __pyx_L8_try_end;__pyx_L3_error:;__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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_L4_exception_handled:;__Pyx_XGIVEREF(__pyx_t_5);__Pyx_XGIVEREF(__pyx_t_6);__Pyx_XGIVEREF(__pyx_t_7);__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);__pyx_L8_try_end:;}
+047: self.spawn_tree_locals = current.spawn_tree_locals
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_current), __pyx_n_s_spawn_tree_locals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L3_error)__Pyx_GOTREF(__pyx_t_1);if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_spawn_tree_locals, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L3_error)__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+048: except AttributeError:
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);if (__pyx_t_4) {__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.TrackedRawGreenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 48, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_1);__Pyx_GOTREF(__pyx_t_2);__Pyx_GOTREF(__pyx_t_3);
+049: self.spawn_tree_locals = {}
__pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 49, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_8);if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_spawn_tree_locals, __pyx_t_8) < 0) __PYX_ERR(0, 49, __pyx_L5_except_error)__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+050: if current.parent:
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_current), __pyx_n_s_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_8);__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 50, __pyx_L5_except_error)__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;if (__pyx_t_9) {}__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;goto __pyx_L4_exception_handled;}goto __pyx_L5_except_error;__pyx_L5_except_error:;
+051: current.spawn_tree_locals = self.spawn_tree_locals
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_spawn_tree_locals); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 51, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_8);if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_current), __pyx_n_s_spawn_tree_locals, __pyx_t_8) < 0) __PYX_ERR(0, 51, __pyx_L5_except_error)__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
052:
053:
+054: class SwitchOutGreenletWithLoop(TrackedRawGreenlet):
struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop {PyObject *(*__pyx_switch)(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *, int __pyx_skip_dispatch);PyObject *(*switch_out)(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *, int __pyx_skip_dispatch);};static struct __pyx_vtabstruct_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_vtabptr_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop;
055: # Subclasses must define:
056: # - self.loop
057:
058: # This class defines loop in its .pxd for Cython. This lets us avoid
059: # circular dependencies with the hub.
060:
+061: def switch(self):
static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self, int __pyx_skip_dispatch) {PyObject *__pyx_v_switch_out = NULL;PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch", 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_SLOTSstatic 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_switch); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);#ifdef __Pyx_CyFunction_USEDif (!__Pyx_IsCyOrPyCFunction(__pyx_t_1)#elseif (!PyCFunction_Check(__pyx_t_1)#endif || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch)) {__Pyx_XDECREF(__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, 61, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;}__pyx_r = __pyx_t_2;__pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;goto __pyx_L0;}#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;}#endif__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS}#endif}/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_XDECREF(__pyx_t_2);__Pyx_XDECREF(__pyx_t_3);__Pyx_XDECREF(__pyx_t_4);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = 0;__pyx_L0:;__Pyx_XDECREF(__pyx_v_switch_out);__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch, "SwitchOutGreenletWithLoop.switch(self)");static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch = {"switch", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch (wrapper)", 0);__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_self));/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch", 0);__Pyx_XDECREF(__pyx_r);__pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_r = __pyx_t_1;__pyx_t_1 = 0;goto __pyx_L0;/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = NULL;__pyx_L0:;__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}__pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 61, __pyx_L1_error)__Pyx_GOTREF(__pyx_tuple__4);__Pyx_GIVEREF(__pyx_tuple__4);__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_1switch, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SwitchOutGreenletWithLoop_switch, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop->tp_dict, __pyx_n_s_switch, __pyx_t_3) < 0) __PYX_ERR(0, 61, __pyx_L1_error)__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;PyType_Modified(__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop);__pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__greenlet_primitives, __pyx_n_s_switch, 61, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 61, __pyx_L1_error)
+062: switch_out = getattr(getcurrent(), 'switch_out', None) # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_29_gevent_c_greenlet_primitives_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_t_2 = __Pyx_GetAttr3(__pyx_t_1, __pyx_n_s_switch_out, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;__pyx_v_switch_out = __pyx_t_2;__pyx_t_2 = 0;
+063: if switch_out is not None:
__pyx_t_6 = (__pyx_v_switch_out != Py_None);if (__pyx_t_6) {}
+064: switch_out()
__Pyx_INCREF(__pyx_v_switch_out);__pyx_t_1 = __pyx_v_switch_out; __pyx_t_3 = NULL;__pyx_t_5 = 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_5 = 1;}}{PyObject *__pyx_callargs[1] = {__pyx_t_3, };__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __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;
+065: return _greenlet_switch(self) # pylint:disable=undefined-variable
__Pyx_XDECREF(__pyx_r);__pyx_t_2 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives__greenlet_switch(((PyGreenlet *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__pyx_r = __pyx_t_2;__pyx_t_2 = 0;goto __pyx_L0;
066:
+067: def switch_out(self):
static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch_out(CYTHON_UNUSED struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self, int __pyx_skip_dispatch) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch_out", 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_SLOTSstatic 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_switch_out); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);#ifdef __Pyx_CyFunction_USEDif (!__Pyx_IsCyOrPyCFunction(__pyx_t_1)#elseif (!PyCFunction_Check(__pyx_t_1)#endif || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out)) {__Pyx_XDECREF(__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, 67, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;}__pyx_r = __pyx_t_2;__pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;goto __pyx_L0;}#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;}#endif__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS}#endif}/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_XDECREF(__pyx_t_2);__Pyx_XDECREF(__pyx_t_3);__Pyx_XDECREF(__pyx_t_4);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch_out", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = 0;__pyx_L0:;__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out, "SwitchOutGreenletWithLoop.switch_out(self)");static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out = {"switch_out", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch_out (wrapper)", 0);__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out(((struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_v_self));/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_2switch_out(struct __pyx_obj_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_self) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("switch_out", 0);__Pyx_XDECREF(__pyx_r);__pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_switch_out(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_r = __pyx_t_1;__pyx_t_1 = 0;goto __pyx_L0;/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch_out", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = NULL;__pyx_L0:;__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_25SwitchOutGreenletWithLoop_3switch_out, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_SwitchOutGreenletWithLoop_switch_2, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop->tp_dict, __pyx_n_s_switch_out, __pyx_t_3) < 0) __PYX_ERR(0, 67, __pyx_L1_error)__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;PyType_Modified(__pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_SwitchOutGreenletWithLoop);__pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__greenlet_primitives, __pyx_n_s_switch_out, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 67, __pyx_L1_error)
+068: raise BlockingSwitchOutError('Impossible to call blocking function in the event loop callback')
__Pyx_INCREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_BlockingSwitchOutError);__pyx_t_2 = __pyx_v_6gevent_29_gevent_c_greenlet_primitives_BlockingSwitchOutError; __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_kp_s_Impossible_to_call_blocking_func};__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, 68, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;}__Pyx_Raise(__pyx_t_1, 0, 0, 0);__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;__PYX_ERR(0, 68, __pyx_L1_error)
069:
070:
+071: def get_reachable_greenlets():
static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(CYTHON_UNUSED int __pyx_skip_dispatch) {PyObject *__pyx_7genexpr__pyx_v_x = NULL;PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_reachable_greenlets", 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_4);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_reachable_greenlets", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = 0;__pyx_L0:;__Pyx_XDECREF(__pyx_7genexpr__pyx_v_x);__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets, "get_reachable_greenlets() -> list");static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets = {"get_reachable_greenlets", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_reachable_greenlets (wrapper)", 0);__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(__pyx_self);/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(CYTHON_UNUSED PyObject *__pyx_self) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_reachable_greenlets", 0);__Pyx_XDECREF(__pyx_r);__pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_reachable_greenlets(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_r = __pyx_t_1;__pyx_t_1 = 0;goto __pyx_L0;/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_reachable_greenlets", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = NULL;__pyx_L0:;__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_1get_reachable_greenlets, 0, __pyx_n_s_get_reachable_greenlets, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_reachable_greenlets, __pyx_t_3) < 0) __PYX_ERR(0, 71, __pyx_L1_error)__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent__greenlet_primitives, __pyx_n_s_get_reachable_greenlets, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 71, __pyx_L1_error)
072: # We compile this loop with Cython so that it's faster, and so that
073: # the GIL isn't dropped at unpredictable times during the loop.
074: # Dropping the GIL could lead to accessing partly constructed objects
075: # in undefined states (particularly, tuples). This helps close a hole
076: # where a `SystemError: Objects/tupleobject.c bad argument to internal function`
077: # could get raised. (Note that this probably doesn't completely close the hole,
078: # if other threads have dropped the GIL, but hopefully the speed makes that
079: # more rare.) See https://github.com/gevent/gevent/issues/1302
+080: return [
__Pyx_XDECREF(__pyx_r);{ /* enter inner scope */__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_1);
+081: x for x in get_objects()
__Pyx_INCREF(__pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects);__pyx_t_3 = __pyx_v_6gevent_29_gevent_c_greenlet_primitives_get_objects; __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, 81, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;}if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {__pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;__pyx_t_7 = NULL;} else {__pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_3);__pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L5_error)}__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;for (;;) {if (likely(!__pyx_t_7)) {if (likely(PyList_CheckExact(__pyx_t_3))) {if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS__pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 81, __pyx_L5_error)#else__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_2);#endif} else {if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 81, __pyx_L5_error)#else__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_2);#endif}} else {__pyx_t_2 = __pyx_t_7(__pyx_t_3);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, 81, __pyx_L5_error)}break;}__Pyx_GOTREF(__pyx_t_2);}__Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_2);__pyx_t_2 = 0;if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_7genexpr__pyx_v_x))) __PYX_ERR(0, 80, __pyx_L5_error)}__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;goto __pyx_L11_exit_scope;__pyx_L5_error:;__Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0;goto __pyx_L1_error;__pyx_L11_exit_scope:;} /* exit inner scope */__pyx_r = ((PyObject*)__pyx_t_1);__pyx_t_1 = 0;goto __pyx_L0;
+082: if isinstance(x, greenlet) and not getattr(x, 'greenlet_tree_is_ignored', False)
__pyx_t_9 = __Pyx_TypeCheck(__pyx_7genexpr__pyx_v_x, __pyx_ptype_6gevent_29_gevent_c_greenlet_primitives_greenlet); if (__pyx_t_9) {} else {__pyx_t_8 = __pyx_t_9;goto __pyx_L9_bool_binop_done;}__pyx_t_2 = __Pyx_GetAttr3(__pyx_7genexpr__pyx_v_x, __pyx_n_s_greenlet_tree_is_ignored, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L5_error)__Pyx_GOTREF(__pyx_t_2);__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 82, __pyx_L5_error)__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__pyx_t_10 = (!__pyx_t_9);__pyx_t_8 = __pyx_t_10;__pyx_L9_bool_binop_done:;if (__pyx_t_8) {}
083: ]
084:
085: # Cache the global memoryview so cython can optimize.
+086: _memoryview = memoryview
if (!(likely(PyType_CheckExact(__pyx_builtin_memoryview))||((__pyx_builtin_memoryview) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_builtin_memoryview))) __PYX_ERR(0, 86, __pyx_L1_error)__pyx_t_3 = __pyx_builtin_memoryview;__Pyx_INCREF(__pyx_t_3);__Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview, ((PyTypeObject*)__pyx_t_3));__Pyx_GIVEREF(__pyx_t_3);__pyx_t_3 = 0;
+087: try:
{/*try:*/ {}__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;goto __pyx_L7_try_end;__pyx_L2_error:;__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_XGIVEREF(__pyx_t_1);__Pyx_XGIVEREF(__pyx_t_4);__Pyx_XGIVEREF(__pyx_t_5);__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);goto __pyx_L1_error;__pyx_L3_exception_handled:;__Pyx_XGIVEREF(__pyx_t_1);__Pyx_XGIVEREF(__pyx_t_4);__Pyx_XGIVEREF(__pyx_t_5);__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_4, __pyx_t_5);__pyx_L7_try_end:;}
+088: if isinstance(__builtins__, dict):
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_builtins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L2_error)__Pyx_GOTREF(__pyx_t_3);__pyx_t_6 = PyDict_Check(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;if (__pyx_t_6) {goto __pyx_L8;}
089: # Pure-python mode on CPython
+090: _buffer = __builtins__['buffer']
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_builtins); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L2_error)__Pyx_GOTREF(__pyx_t_3);__pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_buffer_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L2_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;if (!(likely(PyType_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_2))) __PYX_ERR(0, 90, __pyx_L2_error)__Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, ((PyTypeObject*)__pyx_t_2));__Pyx_GIVEREF(__pyx_t_2);__pyx_t_2 = 0;
091: else:
092: # Cythonized mode, or PyPy
+093: _buffer = __builtins__.buffer
/*else*/ {__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_builtins); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L2_error)__Pyx_GOTREF(__pyx_t_2);__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_buffer_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L2_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;if (!(likely(PyType_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_t_3))) __PYX_ERR(0, 93, __pyx_L2_error)__Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, ((PyTypeObject*)__pyx_t_3));__Pyx_GIVEREF(__pyx_t_3);__pyx_t_3 = 0;}__pyx_L8:;
+094: except (AttributeError, KeyError):
__pyx_t_7 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_AttributeError, __pyx_builtin_KeyError);if (__pyx_t_7) {__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives", __pyx_clineno, __pyx_lineno, __pyx_filename);if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_8) < 0) __PYX_ERR(0, 94, __pyx_L4_except_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_GOTREF(__pyx_t_2);__Pyx_GOTREF(__pyx_t_8);
095: # Python 3.
+096: _buffer = memoryview
if (!(likely(PyType_CheckExact(__pyx_builtin_memoryview))||((__pyx_builtin_memoryview) == Py_None) || __Pyx_RaiseUnexpectedTypeError("type", __pyx_builtin_memoryview))) __PYX_ERR(0, 96, __pyx_L4_except_error)__pyx_t_9 = __pyx_builtin_memoryview;__Pyx_INCREF(__pyx_t_9);__Pyx_XGOTREF((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer);__Pyx_DECREF_SET(__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer, ((PyTypeObject*)__pyx_t_9));__Pyx_GIVEREF(__pyx_t_9);__pyx_t_9 = 0;__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;goto __pyx_L3_exception_handled;}goto __pyx_L4_except_error;__pyx_L4_except_error:;
097:
+098: def get_memory(data):
static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/static PyObject *__pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_memory(PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {PyObject *__pyx_v_mv = NULL;PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_memory", 0);/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_4);__Pyx_XDECREF(__pyx_t_5);__Pyx_XDECREF(__pyx_t_7);__Pyx_XDECREF(__pyx_t_9);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = 0;__pyx_L0:;__Pyx_XDECREF(__pyx_v_mv);__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data); /*proto*/PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_2get_memory, "get_memory(data)");static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_3get_memory = {"get_memory", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory, METH_O, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_2get_memory};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_3get_memory(PyObject *__pyx_self, PyObject *__pyx_v_data) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_memory (wrapper)", 0);__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_2get_memory(__pyx_self, ((PyObject *)__pyx_v_data));/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_2get_memory(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("get_memory", 0);__Pyx_XDECREF(__pyx_r);__pyx_t_1 = __pyx_f_6gevent_29_gevent_c_greenlet_primitives_get_memory(__pyx_v_data, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_1);__pyx_r = __pyx_t_1;__pyx_t_1 = 0;goto __pyx_L0;/* function exit code */__pyx_L1_error:;__Pyx_XDECREF(__pyx_t_1);__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);__pyx_r = NULL;__pyx_L0:;__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}__pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_data); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 98, __pyx_L1_error)__Pyx_GOTREF(__pyx_tuple__8);__Pyx_GIVEREF(__pyx_tuple__8);__pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_3get_memory, 0, __pyx_n_s_get_memory, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_8);if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_memory, __pyx_t_8) < 0) __PYX_ERR(0, 98, __pyx_L1_error)__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;__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__greenlet_primitives, __pyx_n_s_get_memory, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 98, __pyx_L1_error)
099: # On Python 2, memoryview(memoryview()) can leak in some cases,
100: # notably when an io.BufferedWriter object produced the memoryview.
101: # So we need to check to see if we already have one before we convert.
102: # We do this in Cython to mitigate the performance cost (which turns out to be a
103: # net win.)
104:
105: # We don't specifically test for this leak.
106:
107: # https://github.com/gevent/gevent/issues/1318
+108: try:
{/*try:*/ {}__pyx_L3_error:;__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;__Pyx_XGIVEREF(__pyx_t_1);__Pyx_XGIVEREF(__pyx_t_2);__Pyx_XGIVEREF(__pyx_t_3);__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);goto __pyx_L1_error;__pyx_L7_try_return:;__Pyx_XGIVEREF(__pyx_t_1);__Pyx_XGIVEREF(__pyx_t_2);__Pyx_XGIVEREF(__pyx_t_3);__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);goto __pyx_L0;__pyx_L6_except_return:;__Pyx_XGIVEREF(__pyx_t_1);__Pyx_XGIVEREF(__pyx_t_2);__Pyx_XGIVEREF(__pyx_t_3);__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);goto __pyx_L0;}
+109: mv = _memoryview(data) if not isinstance(data, _memoryview) else data
__pyx_t_5 = ((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);__Pyx_INCREF(__pyx_t_5);__pyx_t_6 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;if ((!__pyx_t_6)) {__pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview), __pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L3_error)__Pyx_GOTREF(__pyx_t_5);__pyx_t_4 = __pyx_t_5;__pyx_t_5 = 0;} else {__Pyx_INCREF(__pyx_v_data);__pyx_t_4 = __pyx_v_data;}__pyx_v_mv = __pyx_t_4;__pyx_t_4 = 0;
+110: if mv.shape:
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L3_error)__Pyx_GOTREF(__pyx_t_4);__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 110, __pyx_L3_error)__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;if (__pyx_t_6) {}
+111: return mv
__Pyx_XDECREF(__pyx_r);__Pyx_INCREF(__pyx_v_mv);__pyx_r = __pyx_v_mv;goto __pyx_L7_try_return;
112: # No shape, probably working with a ctypes object,
113: # or something else exotic that supports the buffer interface
+114: return mv.tobytes()
__Pyx_XDECREF(__pyx_r);__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L3_error)__Pyx_GOTREF(__pyx_t_5);__pyx_t_7 = NULL;__pyx_t_8 = 0;if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);if (likely(__pyx_t_7)) {PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);__Pyx_INCREF(__pyx_t_7);__Pyx_INCREF(function);__Pyx_DECREF_SET(__pyx_t_5, function);__pyx_t_8 = 1;}}{PyObject *__pyx_callargs[1] = {__pyx_t_7, };__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8);__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L3_error)__Pyx_GOTREF(__pyx_t_4);__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;}__pyx_r = __pyx_t_4;__pyx_t_4 = 0;goto __pyx_L7_try_return;
+115: except TypeError:
__pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);if (__pyx_t_8) {__Pyx_AddTraceback("gevent._gevent_c_greenlet_primitives.get_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 115, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_4);__Pyx_GOTREF(__pyx_t_5);__Pyx_GOTREF(__pyx_t_7);
116: # fixes "python2.7 array.array doesn't support memoryview used in
117: # gevent.socket.send" issue
118: # (http://code.google.com/p/gevent/issues/detail?id=94)
+119: if _buffer is _memoryview:
__pyx_t_6 = (__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer == __pyx_v_6gevent_29_gevent_c_greenlet_primitives__memoryview);if (unlikely(__pyx_t_6)) {}
120: # Py3
+121: raise
__Pyx_GIVEREF(__pyx_t_4);__Pyx_GIVEREF(__pyx_t_5);__Pyx_XGIVEREF(__pyx_t_7);__Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_5, __pyx_t_7);__pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_7 = 0; __PYX_ERR(0, 121, __pyx_L5_except_error)
+122: return _buffer(data)
__Pyx_XDECREF(__pyx_r);__pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_6gevent_29_gevent_c_greenlet_primitives__buffer), __pyx_v_data); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L5_except_error)__Pyx_GOTREF(__pyx_t_9);__pyx_r = __pyx_t_9;__pyx_t_9 = 0;__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;goto __pyx_L6_except_return;}goto __pyx_L5_except_error;__pyx_L5_except_error:;
123:
124:
125:
+126: def _init():
/* Python wrapper */static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_5_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/PyDoc_STRVAR(__pyx_doc_6gevent_29_gevent_c_greenlet_primitives_4_init, "_init()");static PyMethodDef __pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_5_init = {"_init", (PyCFunction)__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_5_init, METH_NOARGS, __pyx_doc_6gevent_29_gevent_c_greenlet_primitives_4_init};static PyObject *__pyx_pw_6gevent_29_gevent_c_greenlet_primitives_5_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);PyObject *__pyx_r = 0;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("_init (wrapper)", 0);__pyx_r = __pyx_pf_6gevent_29_gevent_c_greenlet_primitives_4_init(__pyx_self);/* function exit code */__Pyx_RefNannyFinishContext();return __pyx_r;}static PyObject *__pyx_pf_6gevent_29_gevent_c_greenlet_primitives_4_init(CYTHON_UNUSED PyObject *__pyx_self) {PyObject *__pyx_r = NULL;__Pyx_RefNannyDeclarations__Pyx_RefNannySetupContext("_init", 0);/* function exit code */__pyx_r = Py_None; __Pyx_INCREF(Py_None);__Pyx_XGIVEREF(__pyx_r);__Pyx_RefNannyFinishContext();return __pyx_r;}__pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_29_gevent_c_greenlet_primitives_5_init, 0, __pyx_n_s_init_2, NULL, __pyx_n_s_gevent__gevent_c_greenlet_primit, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_8);if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_2, __pyx_t_8) < 0) __PYX_ERR(0, 126, __pyx_L1_error)__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+127: greenlet_init() # pylint:disable=undefined-variable
__pyx_f_6gevent_29_gevent_c_greenlet_primitives_greenlet_init();
128:
+129: _init()
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_init_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 129, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_8);__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 129, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
130:
+131: from gevent._util import import_c_accel
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __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_8 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 131, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_8);__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__pyx_t_2 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __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, 131, __pyx_L1_error)__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+132: import_c_accel(globals(), 'gevent.__greenlet_primitives')
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_8);__pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_3);__Pyx_GIVEREF(__pyx_t_2);PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);__Pyx_INCREF(__pyx_kp_s_gevent___greenlet_primitives);__Pyx_GIVEREF(__pyx_kp_s_gevent___greenlet_primitives);PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_s_gevent___greenlet_primitives);__pyx_t_2 = 0;__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)__Pyx_GOTREF(__pyx_t_2);__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;