Generated by Cython 0.29.7
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.c
+0001: # Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details.
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0002: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
0003:
0004: from __future__ import absolute_import, print_function, division
0005:
+0006: from sys import _getframe as sys_getframe
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_getframe); __Pyx_GIVEREF(__pyx_n_s_getframe); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_getframe); __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __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_getframe); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_sys_getframe); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_sys_getframe, __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;
+0007: from sys import exc_info as sys_exc_info
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_exc_info); __Pyx_GIVEREF(__pyx_n_s_exc_info); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exc_info); __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __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_exc_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_sys_exc_info, __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;
+0008: from weakref import ref as wref
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_ref); __Pyx_GIVEREF(__pyx_n_s_ref); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ref); __pyx_t_2 = __Pyx_Import(__pyx_n_s_weakref, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __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_ref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_wref); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_wref, __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;
0009:
0010: # XXX: How to get cython to let us rename this as RawGreenlet
0011: # like we prefer?
+0012: from greenlet import greenlet
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __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_1 = __Pyx_Import(__pyx_n_s_greenlet, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __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;
+0013: from greenlet import GreenletExit
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_GreenletExit); __Pyx_GIVEREF(__pyx_n_s_GreenletExit); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_GreenletExit); __pyx_t_2 = __Pyx_Import(__pyx_n_s_greenlet, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_GreenletExit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_GreenletExit, __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;
0014:
+0015: from gevent._compat import reraise
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_reraise); __Pyx_GIVEREF(__pyx_n_s_reraise); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_reraise); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__compat, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_reraise); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_reraise); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_reraise, __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;
+0016: from gevent._compat import PYPY as _PYPY
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_PYPY_2); __Pyx_GIVEREF(__pyx_n_s_PYPY_2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PYPY_2); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__compat, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PYPY_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L1_error) __pyx_v_6gevent_9_greenlet__PYPY = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0017: from gevent._tblib import dump_traceback
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_dump_traceback); __Pyx_GIVEREF(__pyx_n_s_dump_traceback); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_dump_traceback); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__tblib, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __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_dump_traceback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_dump_traceback); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_dump_traceback, __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;
+0018: from gevent._tblib import load_traceback
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_load_traceback); __Pyx_GIVEREF(__pyx_n_s_load_traceback); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_load_traceback); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__tblib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __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_load_traceback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_load_traceback); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_load_traceback, __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;
0019:
+0020: from gevent.exceptions import InvalidSwitchError
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_InvalidSwitchError); __Pyx_GIVEREF(__pyx_n_s_InvalidSwitchError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_InvalidSwitchError); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent_exceptions, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_InvalidSwitchError); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_InvalidSwitchError, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0021:
+0022: from gevent._hub_primitives import iwait_on_objects as iwait
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_iwait_on_objects); __Pyx_GIVEREF(__pyx_n_s_iwait_on_objects); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_iwait_on_objects); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__hub_primitives, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __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_iwait_on_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_iwait); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_iwait, __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;
+0023: from gevent._hub_primitives import wait_on_objects as wait
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_wait_on_objects); __Pyx_GIVEREF(__pyx_n_s_wait_on_objects); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_wait_on_objects); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__hub_primitives, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __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_wait_on_objects); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_wait); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_wait, __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;
0024:
+0025: from gevent.timeout import Timeout
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Timeout); __Pyx_GIVEREF(__pyx_n_s_Timeout); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Timeout); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_timeout, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_Timeout); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_Timeout, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0026:
+0027: from gevent._config import config as GEVENT_CONFIG
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_config); __Pyx_GIVEREF(__pyx_n_s_config); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_config); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__config, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __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_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet_GEVENT_CONFIG); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet_GEVENT_CONFIG, __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;
+0028: from gevent._util import readproperty
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_readproperty); __Pyx_GIVEREF(__pyx_n_s_readproperty); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_readproperty); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __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_readproperty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_readproperty, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0029: from gevent._hub_local import get_hub_noargs as get_hub
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_get_hub_noargs); __Pyx_GIVEREF(__pyx_n_s_get_hub_noargs); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_hub_noargs); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__hub_local, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __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_get_hub_noargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hub_noargs, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0030: from gevent import _waiter
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_waiter_2); __Pyx_GIVEREF(__pyx_n_s_waiter_2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_waiter_2); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __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_waiter_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_waiter_2, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0031:
0032:
+0033: __all__ = [
__pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __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_INCREF(__pyx_n_s_joinall); __Pyx_GIVEREF(__pyx_n_s_joinall); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_joinall); __Pyx_INCREF(__pyx_n_s_killall); __Pyx_GIVEREF(__pyx_n_s_killall); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_killall); if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0034: 'Greenlet',
0035: 'joinall',
0036: 'killall',
0037: ]
0038:
0039:
0040: # In Cython, we define these as 'cdef inline' functions. The
0041: # compilation unit cannot have a direct assignment to them (import
0042: # is assignment) without generating a 'lvalue is not valid target'
0043: # error.
+0044: locals()['getcurrent'] = __import__('greenlet').getcurrent
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(PyDict_SetItem(__pyx_t_2, __pyx_n_s_getcurrent, __pyx_t_1) < 0)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_greenlet); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21);
+0045: locals()['greenlet_init'] = lambda: None
/* "src/gevent/greenlet.py":45 * # error. * locals()['getcurrent'] = __import__('greenlet').getcurrent * locals()['greenlet_init'] = lambda: None # <<<<<<<<<<<<<< * locals()['Waiter'] = _waiter.Waiter * # With Cython, this raises a TypeError if the parent is *not* */ /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_6lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_9_greenlet_6lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_9_greenlet_6lambda, METH_NOARGS, 0}; static PyObject *__pyx_pw_6gevent_9_greenlet_6lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_6gevent_9_greenlet_lambda(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_9_greenlet_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; } /* "src/gevent/greenlet.py":45 * # error. * locals()['getcurrent'] = __import__('greenlet').getcurrent * locals()['greenlet_init'] = lambda: None # <<<<<<<<<<<<<< * locals()['Waiter'] = _waiter.Waiter * # With Cython, this raises a TypeError if the parent is *not* */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_6lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(PyDict_SetItem(__pyx_t_2, __pyx_n_s_greenlet_init, __pyx_t_1) < 0)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0046: locals()['Waiter'] = _waiter.Waiter
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_waiter_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Waiter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __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, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_Waiter, __pyx_t_2) < 0)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0047: # With Cython, this raises a TypeError if the parent is *not*
0048: # the hub (SwitchOutGreenletWithLoop); in pure-Python, we will
0049: # very likely get an AttributeError immediately after when we access `loop`;
0050: # The TypeError message is more informative on Python 2.
0051: # This must ONLY be called when we know that `s` is not None and is in fact a greenlet
0052: # object (e.g., when called on `self`)
+0053: locals()['get_my_hub'] = lambda s: s.parent
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_7lambda1(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_9_greenlet_7lambda1 = {"lambda1", (PyCFunction)__pyx_pw_6gevent_9_greenlet_7lambda1, METH_O, 0}; static PyObject *__pyx_pw_6gevent_9_greenlet_7lambda1(PyObject *__pyx_self, PyObject *__pyx_v_s) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_6gevent_9_greenlet_lambda1(__pyx_self, ((PyObject *)__pyx_v_s)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_9_greenlet_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda1", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __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._greenlet.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_7lambda1, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_get_my_hub, __pyx_t_2) < 0)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0054: # This must also ONLY be called when we know that S is not None and is in fact a greenlet
0055: # object (including the result of getcurrent())
+0056: locals()['get_generic_parent'] = lambda s: s.parent
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8lambda2(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8lambda2 = {"lambda2", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8lambda2, METH_O, 0}; static PyObject *__pyx_pw_6gevent_9_greenlet_8lambda2(PyObject *__pyx_self, PyObject *__pyx_v_s) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_6gevent_9_greenlet_lambda2(__pyx_self, ((PyObject *)__pyx_v_s)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_9_greenlet_lambda2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda2", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __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._greenlet.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8lambda2, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_get_generic_parent, __pyx_t_2) < 0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0057:
0058: # Frame access
+0059: locals()['get_f_back'] = lambda frame: frame.f_back
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_9lambda3(PyObject *__pyx_self, PyObject *__pyx_v_frame); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_9_greenlet_9lambda3 = {"lambda3", (PyCFunction)__pyx_pw_6gevent_9_greenlet_9lambda3, METH_O, 0}; static PyObject *__pyx_pw_6gevent_9_greenlet_9lambda3(PyObject *__pyx_self, PyObject *__pyx_v_frame) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_6gevent_9_greenlet_lambda3(__pyx_self, ((PyObject *)__pyx_v_frame)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_9_greenlet_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frame) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda3", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_back); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __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._greenlet.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_9lambda3, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_get_f_back, __pyx_t_2) < 0)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0060: locals()['get_f_lineno'] = lambda frame: frame.f_lineno
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_10lambda4(PyObject *__pyx_self, PyObject *__pyx_v_frame); /*proto*/ static PyMethodDef __pyx_mdef_6gevent_9_greenlet_10lambda4 = {"lambda4", (PyCFunction)__pyx_pw_6gevent_9_greenlet_10lambda4, METH_O, 0}; static PyObject *__pyx_pw_6gevent_9_greenlet_10lambda4(PyObject *__pyx_self, PyObject *__pyx_v_frame) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0); __pyx_r = __pyx_lambda_funcdef_6gevent_9_greenlet_lambda4(__pyx_self, ((PyObject *)__pyx_v_frame)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_lambda_funcdef_6gevent_9_greenlet_lambda4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frame) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda4", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_frame, __pyx_n_s_f_lineno); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __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._greenlet.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_10lambda4, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_get_f_lineno, __pyx_t_2) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0061:
+0062: if _PYPY:
__pyx_t_3 = (__pyx_v_6gevent_9_greenlet__PYPY != 0); if (__pyx_t_3) { /* … */ }
+0063: import _continuation # pylint:disable=import-error
__pyx_t_2 = __Pyx_Import(__pyx_n_s_continuation, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_continuation, __pyx_t_2) < 0) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0064: _continulet = _continuation.continulet
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_continuation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_continulet); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_continulet_2, __pyx_t_1) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0065:
0066:
0067: class SpawnedLink(object):
0068: """
0069: A wrapper around link that calls it in another greenlet.
0070:
0071: Can be called only from main loop.
0072: """
+0073: __slots__ = ['callback']
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_callback); __Pyx_GIVEREF(__pyx_n_s_callback); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_callback); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_SpawnedLink->tp_dict, __pyx_n_s_slots, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_SpawnedLink);
0074:
+0075: def __init__(self, callback):
/* Python wrapper */ static int __pyx_pw_6gevent_9_greenlet_11SpawnedLink_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_9_greenlet_11SpawnedLink_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 75, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_callback = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 75, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink___init__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self), __pyx_v_callback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_9_greenlet_11SpawnedLink___init__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self, PyObject *__pyx_v_callback) { 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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0076: if not callable(callback):
__pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0077: raise TypeError("Expected callable: %r" % (callback, ))
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_callback); __Pyx_GIVEREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_callback); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Expected_callable_r, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __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, 77, __pyx_L1_error)
+0078: self.callback = callback
__Pyx_INCREF(__pyx_v_callback); __Pyx_GIVEREF(__pyx_v_callback); __Pyx_GOTREF(__pyx_v_self->callback); __Pyx_DECREF(__pyx_v_self->callback); __pyx_v_self->callback = __pyx_v_callback;
0079:
+0080: def __call__(self, source):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 80, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_source = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 80, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_2__call__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self), __pyx_v_source); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_11SpawnedLink_2__call__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self, PyObject *__pyx_v_source) { PyGreenlet *__pyx_v_g = 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._greenlet.SpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0081: g = greenlet(self.callback, get_hub())
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_11__hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_self->callback); __Pyx_GIVEREF(__pyx_v_self->callback); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->callback); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_9_greenlet_greenlet), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_g = ((PyGreenlet *)__pyx_t_1); __pyx_t_1 = 0;
+0082: g.switch(source)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_g), __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_source) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_source); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __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;
0083:
+0084: def __hash__(self):
/* Python wrapper */ static Py_hash_t __pyx_pw_6gevent_9_greenlet_11SpawnedLink_5__hash__(PyObject *__pyx_v_self); /*proto*/ static Py_hash_t __pyx_pw_6gevent_9_greenlet_11SpawnedLink_5__hash__(PyObject *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_4__hash__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_hash_t __pyx_pf_6gevent_9_greenlet_11SpawnedLink_4__hash__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self) { Py_hash_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__hash__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0085: return hash(self.callback)
__pyx_t_1 = __pyx_v_self->callback; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
0086:
+0087: def __eq__(self, other):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_7__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_6__eq__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self), ((PyObject *)__pyx_v_other)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_11SpawnedLink_6__eq__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__eq__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0088: return self.callback == getattr(other, 'callback', other)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_other, __pyx_n_s_callback, __pyx_v_other); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_RichCompare(__pyx_v_self->callback, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0089:
+0090: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_9__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_9__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_8__str__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_11SpawnedLink_8__str__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0091: return str(self.callback)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_self->callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0092:
+0093: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_11__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_11__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_10__repr__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_11SpawnedLink_10__repr__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0094: return repr(self.callback)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_v_self->callback; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0095:
+0096: def __getattr__(self, item):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_13__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_11SpawnedLink_13__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_11SpawnedLink_12__getattr__(((struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_11SpawnedLink_12__getattr__(struct __pyx_obj_6gevent_9_greenlet_SpawnedLink *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getattr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._greenlet.SpawnedLink.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0097: assert item != 'callback'
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_item, __pyx_n_s_callback, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 97, __pyx_L1_error) if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 97, __pyx_L1_error) } } #endif
+0098: return getattr(self.callback, item)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_v_self->callback; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetAttr(__pyx_t_2, __pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
0099:
0100:
0101: class SuccessSpawnedLink(SpawnedLink):
0102: """A wrapper around link that calls it in another greenlet only if source succeed.
0103:
0104: Can be called only from main loop.
0105: """
+0106: __slots__ = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_SuccessSpawnedLink->tp_dict, __pyx_n_s_slots, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_SuccessSpawnedLink);
0107:
+0108: def __call__(self, source):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_18SuccessSpawnedLink_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_18SuccessSpawnedLink_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 108, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_source = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.SuccessSpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_18SuccessSpawnedLink___call__(((struct __pyx_obj_6gevent_9_greenlet_SuccessSpawnedLink *)__pyx_v_self), __pyx_v_source); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_18SuccessSpawnedLink___call__(struct __pyx_obj_6gevent_9_greenlet_SuccessSpawnedLink *__pyx_v_self, PyObject *__pyx_v_source) { 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_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._greenlet.SuccessSpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0109: if source.successful():
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_successful); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { /* … */ }
+0110: return SpawnedLink.__call__(self, source)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_SpawnedLink), __pyx_n_s_call); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_5 = 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_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_source}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_source}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_source); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0111:
0112:
0113: class FailureSpawnedLink(SpawnedLink):
0114: """A wrapper around link that calls it in another greenlet only if source failed.
0115:
0116: Can be called only from main loop.
0117: """
+0118: __slots__ = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_FailureSpawnedLink->tp_dict, __pyx_n_s_slots, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_FailureSpawnedLink);
0119:
+0120: def __call__(self, source):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_18FailureSpawnedLink_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_18FailureSpawnedLink_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_source = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 120, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.FailureSpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_18FailureSpawnedLink___call__(((struct __pyx_obj_6gevent_9_greenlet_FailureSpawnedLink *)__pyx_v_self), __pyx_v_source); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_18FailureSpawnedLink___call__(struct __pyx_obj_6gevent_9_greenlet_FailureSpawnedLink *__pyx_v_self, PyObject *__pyx_v_source) { 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_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._greenlet.FailureSpawnedLink.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0121: if not source.successful():
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_successful); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = ((!__pyx_t_4) != 0); if (__pyx_t_5) { /* … */ }
+0122: return SpawnedLink.__call__(self, source)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_SpawnedLink), __pyx_n_s_call); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __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; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_source}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_source}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_source); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0123:
0124: class _Frame(object):
0125:
+0126: __slots__ = ('f_code', 'f_lineno', 'f_back')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet__Frame->tp_dict, __pyx_n_s_slots, __pyx_tuple__22) < 0) __PYX_ERR(0, 126, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_9_greenlet__Frame); /* … */ __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_f_code, __pyx_n_s_f_lineno, __pyx_n_s_f_back); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22);
0127:
+0128: def __init__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_9_greenlet_6_Frame_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_9_greenlet_6_Frame_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __pyx_r = __pyx_pf_6gevent_9_greenlet_6_Frame___init__(((struct __pyx_obj_6gevent_9_greenlet__Frame *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_9_greenlet_6_Frame___init__(struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0129: self.f_code = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->f_code); __Pyx_DECREF(((PyObject *)__pyx_v_self->f_code)); __pyx_v_self->f_code = ((PyCodeObject *)Py_None);
+0130: self.f_back = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->f_back); __Pyx_DECREF(((PyObject *)__pyx_v_self->f_back)); __pyx_v_self->f_back = ((struct __pyx_obj_6gevent_9_greenlet__Frame *)Py_None);
+0131: self.f_lineno = 0
__pyx_v_self->f_lineno = 0;
0132:
0133: @property
+0134: def f_globals(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_6_Frame_9f_globals_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_6_Frame_9f_globals_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_6_Frame_9f_globals___get__(((struct __pyx_obj_6gevent_9_greenlet__Frame *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_6_Frame_9f_globals___get__(CYTHON_UNUSED struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0135: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
0136:
0137:
+0138: def _extract_stack(limit):
static CYTHON_INLINE struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_f_6gevent_9_greenlet__extract_stack(int __pyx_v_limit) { PyFrameObject *__pyx_v_frame = 0; struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_v_newest_Frame = 0; struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_v_newer_Frame = 0; struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_v_older_Frame = 0; struct __pyx_obj_6gevent_9_greenlet__Frame *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_extract_stack", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._greenlet._extract_stack", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_frame); __Pyx_XDECREF((PyObject *)__pyx_v_newest_Frame); __Pyx_XDECREF((PyObject *)__pyx_v_newer_Frame); __Pyx_XDECREF((PyObject *)__pyx_v_older_Frame); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0139: try:
{ /*try:*/ { /* … */ } __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_L8_try_end; __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_6); __pyx_t_6 = 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_L4_exception_handled:; __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); __pyx_L8_try_end:; }
+0140: frame = sys_getframe()
__Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_getframe); __pyx_t_5 = __pyx_v_6gevent_9_greenlet_sys_getframe; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6gevent_9_greenlet_FrameType))))) __PYX_ERR(0, 140, __pyx_L3_error) __pyx_v_frame = ((PyFrameObject *)__pyx_t_4); __pyx_t_4 = 0;
+0141: except ValueError:
__pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError); if (__pyx_t_7) { __Pyx_AddTraceback("gevent._greenlet._extract_stack", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 141, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6);
0142: # In certain embedded cases that directly use the Python C api
0143: # to call Greenlet.spawn (e.g., uwsgi) this can raise
0144: # `ValueError: call stack is not deep enough`. This is because
0145: # the Cython stack frames for Greenlet.spawn ->
0146: # Greenlet.__init__ -> _extract_stack are all on the C level,
0147: # not the Python level.
0148: # See https://github.com/gevent/gevent/issues/1212
+0149: frame = None
__Pyx_INCREF(Py_None); __Pyx_XDECREF_SET(__pyx_v_frame, ((PyFrameObject *)Py_None)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:;
0150:
+0151: newest_Frame = None
__Pyx_INCREF(Py_None);
__pyx_v_newest_Frame = ((struct __pyx_obj_6gevent_9_greenlet__Frame *)Py_None);
+0152: newer_Frame = None
__Pyx_INCREF(Py_None);
__pyx_v_newer_Frame = ((struct __pyx_obj_6gevent_9_greenlet__Frame *)Py_None);
0153:
+0154: while limit and frame is not None:
while (1) { __pyx_t_9 = (__pyx_v_limit != 0); if (__pyx_t_9) { } else { __pyx_t_8 = __pyx_t_9; goto __pyx_L13_bool_binop_done; } __pyx_t_9 = (((PyObject *)__pyx_v_frame) != Py_None); __pyx_t_10 = (__pyx_t_9 != 0); __pyx_t_8 = __pyx_t_10; __pyx_L13_bool_binop_done:; if (!__pyx_t_8) break;
+0155: limit -= 1
__pyx_v_limit = (__pyx_v_limit - 1);
+0156: older_Frame = _Frame()
__pyx_t_6 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_9_greenlet__Frame)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_older_Frame, ((struct __pyx_obj_6gevent_9_greenlet__Frame *)__pyx_t_6)); __pyx_t_6 = 0;
0157: # Arguments are always passed to the constructor as Python objects,
0158: # meaning we wind up boxing the f_lineno just to unbox it if we pass it.
0159: # It's faster to simply assign once the object is created.
+0160: older_Frame.f_code = frame.f_code
__pyx_t_6 = ((PyObject *)__pyx_v_frame->f_code); __Pyx_INCREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_older_Frame->f_code); __Pyx_DECREF(((PyObject *)__pyx_v_older_Frame->f_code)); __pyx_v_older_Frame->f_code = ((PyCodeObject *)__pyx_t_6); __pyx_t_6 = 0;
+0161: older_Frame.f_lineno = get_f_lineno(frame) # pylint:disable=undefined-variable
__pyx_v_older_Frame->f_lineno = __pyx_f_6gevent_9_greenlet_get_f_lineno(__pyx_v_frame);
+0162: if newer_Frame is not None:
__pyx_t_8 = (((PyObject *)__pyx_v_newer_Frame) != Py_None); __pyx_t_10 = (__pyx_t_8 != 0); if (__pyx_t_10) { /* … */ }
+0163: newer_Frame.f_back = older_Frame
__Pyx_INCREF(((PyObject *)__pyx_v_older_Frame)); __Pyx_GIVEREF(((PyObject *)__pyx_v_older_Frame)); __Pyx_GOTREF(__pyx_v_newer_Frame->f_back); __Pyx_DECREF(((PyObject *)__pyx_v_newer_Frame->f_back)); __pyx_v_newer_Frame->f_back = __pyx_v_older_Frame;
+0164: newer_Frame = older_Frame
__Pyx_INCREF(((PyObject *)__pyx_v_older_Frame)); __Pyx_DECREF_SET(__pyx_v_newer_Frame, __pyx_v_older_Frame);
+0165: if newest_Frame is None:
__pyx_t_10 = (((PyObject *)__pyx_v_newest_Frame) == Py_None); __pyx_t_8 = (__pyx_t_10 != 0); if (__pyx_t_8) { /* … */ }
+0166: newest_Frame = newer_Frame
__Pyx_INCREF(((PyObject *)__pyx_v_newer_Frame)); __Pyx_DECREF_SET(__pyx_v_newest_Frame, __pyx_v_newer_Frame);
0167:
+0168: frame = get_f_back(frame) # pylint:disable=undefined-variable
__pyx_t_6 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_f_back(__pyx_v_frame)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF_SET(__pyx_v_frame, ((PyFrameObject *)__pyx_t_6)); __pyx_t_6 = 0; }
0169:
+0170: return newest_Frame
__Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_newest_Frame)); __pyx_r = __pyx_v_newest_Frame; goto __pyx_L0;
0171:
0172:
+0173: _greenlet__init__ = greenlet.__init__
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_greenlet), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet__greenlet__init__); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__greenlet__init__, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
0174:
+0175: class Greenlet(greenlet):
struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet { int (*has_links)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch); PyObject *(*join)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_9_greenlet_8Greenlet_join *__pyx_optional_args); int (*ready)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch); int (*successful)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch); PyObject *(*rawlink)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, PyObject *, int __pyx_skip_dispatch); PyObject *(*_formatinfo)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch); PyObject *(*_get_minimal_ident)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); int (*__pyx___started_but_aborted)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); int (*__pyx___start_cancelled_by_kill)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); int (*__pyx___start_pending)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); int (*__pyx___never_started_or_killed)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); int (*__pyx___start_completed)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); PyObject *(*__pyx___handle_death_before_start)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, PyObject *); PyObject *(*__pyx___cancel_start)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *); PyObject *(*_report_result)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, PyObject *); PyObject *(*_report_error)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, PyObject *); PyObject *(*_notify_links)(struct __pyx_obj_6gevent_9_greenlet_Greenlet *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *__pyx_vtabptr_6gevent_9_greenlet_Greenlet;
0176: """
0177: A light-weight cooperatively-scheduled execution unit.
0178: """
0179: # pylint:disable=too-many-public-methods,too-many-instance-attributes
0180:
+0181: spawning_stack_limit = 10
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_spawning_stack_limit, __pyx_int_10) < 0) __PYX_ERR(0, 181, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
0182:
0183: # pylint:disable=keyword-arg-before-vararg,super-init-not-called
+0184: def __init__(self, run=None, *args, **kwargs):
/* Python wrapper */ static int __pyx_pw_6gevent_9_greenlet_8Greenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet___init__[] = "\n :param args: The arguments passed to the ``run`` function.\n :param kwargs: The keyword arguments passed to the ``run`` function.\n :keyword callable run: The callable object to run. If not given, this object's\n `_run` method will be invoked (typically defined by subclasses).\n\n .. versionchanged:: 1.1b1\n The ``run`` argument to the constructor is now verified to be a callable\n object. Previously, passing a non-callable object would fail after the greenlet\n was spawned.\n\n .. versionchanged:: 1.3b1\n The ``GEVENT_TRACK_GREENLET_TREE`` configuration value may be set to\n a false value to disable ``spawn_tree_locals``, ``spawning_greenlet``,\n and ``spawning_stack``. The first two will be None in that case, and the\n latter will be empty.\n\n .. versionchanged:: 1.5\n Greenlet objects are now more careful to verify that their ``parent`` is really\n a gevent hub, raising a ``TypeError`` earlier instead of an ``AttributeError`` later.\n "; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_6gevent_9_greenlet_8Greenlet___init__; #endif static int __pyx_pw_6gevent_9_greenlet_8Greenlet_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_run = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; __Pyx_GOTREF(__pyx_v_kwargs); if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); if (unlikely(!__pyx_v_args)) { __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_RefNannyFinishContext(); return -1; } __Pyx_GOTREF(__pyx_v_args); } else { __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); } { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_run,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_run); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 184, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; } } __pyx_v_run = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("gevent._greenlet.Greenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet___init__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_run, __pyx_v_args, __pyx_v_kwargs); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_9_greenlet_8Greenlet___init__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_run, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { PyGreenlet *__pyx_v_spawner = 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_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._greenlet.Greenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_spawner); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0185: """
0186: :param args: The arguments passed to the ``run`` function.
0187: :param kwargs: The keyword arguments passed to the ``run`` function.
0188: :keyword callable run: The callable object to run. If not given, this object's
0189: `_run` method will be invoked (typically defined by subclasses).
0190:
0191: .. versionchanged:: 1.1b1
0192: The ``run`` argument to the constructor is now verified to be a callable
0193: object. Previously, passing a non-callable object would fail after the greenlet
0194: was spawned.
0195:
0196: .. versionchanged:: 1.3b1
0197: The ``GEVENT_TRACK_GREENLET_TREE`` configuration value may be set to
0198: a false value to disable ``spawn_tree_locals``, ``spawning_greenlet``,
0199: and ``spawning_stack``. The first two will be None in that case, and the
0200: latter will be empty.
0201:
0202: .. versionchanged:: 1.5
0203: Greenlet objects are now more careful to verify that their ``parent`` is really
0204: a gevent hub, raising a ``TypeError`` earlier instead of an ``AttributeError`` later.
0205: """
0206: # The attributes are documented in the .rst file
0207:
0208: # greenlet.greenlet(run=None, parent=None)
0209: # Calling it with both positional arguments instead of a keyword
0210: # argument (parent=get_hub()) speeds up creation of this object ~30%:
0211: # python -m timeit -s 'import gevent' 'gevent.Greenlet()'
0212: # Python 3.5: 2.70usec with keywords vs 1.94usec with positional
0213: # Python 3.4: 2.32usec with keywords vs 1.74usec with positional
0214: # Python 3.3: 2.55usec with keywords vs 1.92usec with positional
0215: # Python 2.7: 1.73usec with keywords vs 1.40usec with positional
0216:
0217: # Timings taken Feb 21 2018 prior to integration of #755
0218: # python -m perf timeit -s 'import gevent' 'gevent.Greenlet()'
0219: # 3.6.4 : Mean +- std dev: 1.08 us +- 0.05 us
0220: # 2.7.14 : Mean +- std dev: 1.44 us +- 0.06 us
0221: # PyPy2 5.10.0: Mean +- std dev: 2.14 ns +- 0.08 ns
0222:
0223: # After the integration of spawning_stack, spawning_greenlet,
0224: # and spawn_tree_locals on that same date:
0225: # 3.6.4 : Mean +- std dev: 8.92 us +- 0.36 us -> 8.2x
0226: # 2.7.14 : Mean +- std dev: 14.8 us +- 0.5 us -> 10.2x
0227: # PyPy2 5.10.0: Mean +- std dev: 3.24 us +- 0.17 us -> 1.5x
0228:
0229: # Compiling with Cython gets us to these numbers:
0230: # 3.6.4 : Mean +- std dev: 3.63 us +- 0.14 us
0231: # 2.7.14 : Mean +- std dev: 3.37 us +- 0.20 us
0232: # PyPy2 5.10.0 : Mean +- std dev: 4.44 us +- 0.28 us
0233:
0234: # Switching to reified frames and some more tuning gets us here:
0235: # 3.7.2 : Mean +- std dev: 2.53 us +- 0.15 us
0236: # 2.7.16 : Mean +- std dev: 2.35 us +- 0.12 us
0237: # PyPy2 7.1 : Mean +- std dev: 11.6 us +- 0.4 us
0238:
0239: # Compared to the released 1.4 (tested at the same time):
0240: # 3.7.2 : Mean +- std dev: 3.21 us +- 0.32 us
0241: # 2.7.16 : Mean +- std dev: 3.11 us +- 0.19 us
0242: # PyPy2 7.1 : Mean +- std dev: 12.3 us +- 0.8 us
0243:
+0244: _greenlet__init__(self, None, get_hub())
__pyx_t_2 = ((PyObject *)__pyx_f_6gevent_11__hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet__greenlet__init__); __pyx_t_3 = __pyx_v_6gevent_9_greenlet__greenlet__init__; __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; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), Py_None, __pyx_t_2}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), Py_None, __pyx_t_2}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, Py_None); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0245:
+0246: if run is not None:
__pyx_t_7 = (__pyx_v_run != Py_None); __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ }
+0247: self._run = run
if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run_2, __pyx_v_run) < 0) __PYX_ERR(0, 247, __pyx_L1_error)
0248:
0249: # If they didn't pass a callable at all, then they must
0250: # already have one. Note that subclassing to override the run() method
0251: # itself has never been documented or supported.
+0252: if not callable(self._run):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyCallable_Check(__pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = ((!(__pyx_t_8 != 0)) != 0); if (unlikely(__pyx_t_7)) { /* … */ }
+0253: raise TypeError("The run argument or self._run must be callable")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 253, __pyx_L1_error) /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_The_run_argument_or_self__run_mu); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
0254:
+0255: self.args = args
__Pyx_INCREF(__pyx_v_args); __Pyx_GIVEREF(__pyx_v_args); __Pyx_GOTREF(__pyx_v_self->args); __Pyx_DECREF(__pyx_v_self->args); __pyx_v_self->args = __pyx_v_args;
+0256: self.kwargs = kwargs
__Pyx_INCREF(__pyx_v_kwargs); __Pyx_GIVEREF(__pyx_v_kwargs); __Pyx_GOTREF(__pyx_v_self->kwargs); __Pyx_DECREF(__pyx_v_self->kwargs); __pyx_v_self->kwargs = __pyx_v_kwargs;
+0257: self.value = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->value); __Pyx_DECREF(__pyx_v_self->value); __pyx_v_self->value = Py_None;
0258:
0259: #: An event, such as a timer or a callback that fires. It is established in
0260: #: start() and start_later() as those two objects, respectively.
0261: #: Once this becomes non-None, the Greenlet cannot be started again. Conversely,
0262: #: kill() and throw() check for non-None to determine if this object has ever been
0263: #: scheduled for starting. A placeholder _dummy_event is assigned by them to prevent
0264: #: the greenlet from being started in the future, if necessary.
+0265: self._start_event = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_start_event); __Pyx_DECREF(__pyx_v_self->_start_event); __pyx_v_self->_start_event = Py_None;
0266:
+0267: self._notifier = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_notifier); __Pyx_DECREF(__pyx_v_self->_notifier); __pyx_v_self->_notifier = Py_None;
+0268: self._formatted_info = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_formatted_info); __Pyx_DECREF(__pyx_v_self->_formatted_info); __pyx_v_self->_formatted_info = ((PyObject*)Py_None);
+0269: self._links = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_links); __Pyx_DECREF(__pyx_v_self->_links); __pyx_v_self->_links = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0270: self._ident = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_ident); __Pyx_DECREF(__pyx_v_self->_ident); __pyx_v_self->_ident = Py_None;
0271:
0272: # Initial state: None.
0273: # Completed successfully: (None, None, None)
0274: # Failed with exception: (t, v, dump_traceback(tb)))
+0275: self._exc_info = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = ((PyObject*)Py_None);
0276:
+0277: if GEVENT_CONFIG.track_greenlet_tree:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_9_greenlet_GEVENT_CONFIG, __pyx_n_s_track_greenlet_tree); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_7) { /* … */ goto __pyx_L5; }
+0278: spawner = getcurrent() # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_9_greenlet_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_spawner = ((PyGreenlet *)__pyx_t_1); __pyx_t_1 = 0;
+0279: self.spawning_greenlet = wref(spawner)
__Pyx_INCREF(__pyx_v_6gevent_9_greenlet_wref); __pyx_t_3 = __pyx_v_6gevent_9_greenlet_wref; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_v_spawner)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_spawner)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->spawning_greenlet); __Pyx_DECREF(__pyx_v_self->spawning_greenlet); __pyx_v_self->spawning_greenlet = __pyx_t_1; __pyx_t_1 = 0;
+0280: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L1_error; __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); __pyx_L11_try_end:; }
+0281: self.spawn_tree_locals = spawner.spawn_tree_locals
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_spawner), __pyx_n_s_spawn_tree_locals); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 281, __pyx_L6_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->spawn_tree_locals); __Pyx_DECREF(__pyx_v_self->spawn_tree_locals); __pyx_v_self->spawn_tree_locals = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0282: except AttributeError:
__pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); if (__pyx_t_5) { __Pyx_AddTraceback("gevent._greenlet.Greenlet.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6) < 0) __PYX_ERR(0, 282, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_6);
+0283: self.spawn_tree_locals = {}
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->spawn_tree_locals); __Pyx_DECREF(__pyx_v_self->spawn_tree_locals); __pyx_v_self->spawn_tree_locals = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+0284: if get_generic_parent(spawner) is not None: # pylint:disable=undefined-variable
__pyx_t_2 = __pyx_f_6gevent_9_greenlet_get_generic_parent(__pyx_v_spawner); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = (__pyx_t_2 != Py_None); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L7_exception_handled; } goto __pyx_L8_except_error; __pyx_L8_except_error:;
0285: # The main greenlet has no parent.
0286: # Its children get separate locals.
+0287: spawner.spawn_tree_locals = self.spawn_tree_locals
__pyx_t_2 = __pyx_v_self->spawn_tree_locals; __Pyx_INCREF(__pyx_t_2); if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_spawner), __pyx_n_s_spawn_tree_locals, __pyx_t_2) < 0) __PYX_ERR(0, 287, __pyx_L8_except_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0288:
+0289: self.spawning_stack = _extract_stack(self.spawning_stack_limit)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_spawning_stack_limit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = ((PyObject *)__pyx_f_6gevent_9_greenlet__extract_stack(__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->spawning_stack); __Pyx_DECREF(((PyObject *)__pyx_v_self->spawning_stack)); __pyx_v_self->spawning_stack = ((struct __pyx_obj_6gevent_9_greenlet__Frame *)__pyx_t_6); __pyx_t_6 = 0;
0290: # Don't copy the spawning greenlet's
0291: # '_spawning_stack_frames' into ours. That's somewhat
0292: # confusing, and, if we're not careful, a deep spawn tree
0293: # can lead to excessive memory usage (an infinite spawning
0294: # tree could lead to unbounded memory usage without care
0295: # --- see https://github.com/gevent/gevent/issues/1371)
0296: # The _spawning_stack_frames may be cleared out later if we access spawning_stack
0297: else:
0298: # None is the default for all of these in Cython, but we
0299: # need to declare them for pure-Python mode.
+0300: self.spawning_greenlet = None
/*else*/ { __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->spawning_greenlet); __Pyx_DECREF(__pyx_v_self->spawning_greenlet); __pyx_v_self->spawning_greenlet = Py_None;
+0301: self.spawn_tree_locals = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->spawn_tree_locals); __Pyx_DECREF(__pyx_v_self->spawn_tree_locals); __pyx_v_self->spawn_tree_locals = ((PyObject*)Py_None);
+0302: self.spawning_stack = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->spawning_stack); __Pyx_DECREF(((PyObject *)__pyx_v_self->spawning_stack)); __pyx_v_self->spawning_stack = ((struct __pyx_obj_6gevent_9_greenlet__Frame *)Py_None); } __pyx_L5:;
0303:
+0304: def _get_minimal_ident(self):
static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet__get_minimal_ident(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { struct __pyx_obj_6gevent_7__ident_IdentRegistry *__pyx_v_reg = 0; struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_minimal_ident", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._greenlet.Greenlet._get_minimal_ident", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_reg); __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0305: # Helper function for cython, to allow typing `reg` and making a
0306: # C call to get_ident.
0307:
0308: # If we're being accessed from a hub different than the one running
0309: # us, aka get_hub() is not self.parent, then calling hub.ident_registry.get_ident()
0310: # may be quietly broken: it's not thread safe.
0311: # If our parent is no longer the hub for whatever reason, this will raise a
0312: # AttributeError or TypeError.
+0313: hub = get_my_hub(self) # type:SwitchOutGreenletWithLoop pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1); __pyx_t_1 = 0;
0314:
+0315: reg = hub.ident_registry
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hub), __pyx_n_s_ident_registry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6gevent_7__ident_IdentRegistry))))) __PYX_ERR(0, 315, __pyx_L1_error) __pyx_v_reg = ((struct __pyx_obj_6gevent_7__ident_IdentRegistry *)__pyx_t_1); __pyx_t_1 = 0;
+0316: return reg.get_ident(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_7__ident_IdentRegistry *)__pyx_v_reg->__pyx_vtab)->get_ident(__pyx_v_reg, ((PyObject *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0317:
0318: @property
+0319: def minimal_ident(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_13minimal_ident_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_13minimal_ident_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_13minimal_ident___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_13minimal_ident___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._greenlet.Greenlet.minimal_ident.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0320: """
0321: A small, unique non-negative integer that identifies this object.
0322:
0323: This is similar to :attr:`threading.Thread.ident` (and `id`)
0324: in that as long as this object is alive, no other greenlet *in
0325: this hub* will have the same id, but it makes a stronger
0326: guarantee that the assigned values will be small and
0327: sequential. Sometime after this object has died, the value
0328: will be available for reuse.
0329:
0330: To get ids that are unique across all hubs, combine this with
0331: the hub's (``self.parent``) ``minimal_ident``.
0332:
0333: Accessing this property from threads other than the thread running
0334: this greenlet is not defined.
0335:
0336: .. versionadded:: 1.3a2
0337:
0338: """
0339: # Not @Lazy, implemented manually because _ident is in the structure
0340: # of the greenlet for fast access
+0341: if self._ident is None:
__pyx_t_1 = (__pyx_v_self->_ident == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0342: self._ident = self._get_minimal_ident()
__pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_get_minimal_ident(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_ident); __Pyx_DECREF(__pyx_v_self->_ident); __pyx_v_self->_ident = __pyx_t_3; __pyx_t_3 = 0;
+0343: return self._ident
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_ident); __pyx_r = __pyx_v_self->_ident; goto __pyx_L0;
0344:
+0345: @readproperty
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_readproperty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+0346: def name(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_3name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_2name[] = "Greenlet.name(self)\n\n The greenlet name. By default, a unique name is constructed using\n the :attr:`minimal_ident`. You can assign a string to this\n value to change it. It is shown in the `repr` of this object if it\n has been assigned to or if the `minimal_ident` has already been generated.\n\n .. versionadded:: 1.3a2\n .. versionchanged:: 1.4\n Stop showing generated names in the `repr` when the ``minimal_ident``\n hasn't been requested. This reduces overhead and may be less confusing,\n since ``minimal_ident`` can get reused.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_3name = {"name", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_3name, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_2name}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_3name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("name (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_2name(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_2name(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("name", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.Greenlet.name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_3name, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_name, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_name_2, __pyx_t_1) < 0) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); /* … */ __Pyx_GetNameInClass(__pyx_t_4, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_name_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_name_2, __pyx_t_1) < 0) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_name_2, 346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 346, __pyx_L1_error)
0347: """
0348: The greenlet name. By default, a unique name is constructed using
0349: the :attr:`minimal_ident`. You can assign a string to this
0350: value to change it. It is shown in the `repr` of this object if it
0351: has been assigned to or if the `minimal_ident` has already been generated.
0352:
0353: .. versionadded:: 1.3a2
0354: .. versionchanged:: 1.4
0355: Stop showing generated names in the `repr` when the ``minimal_ident``
0356: hasn't been requested. This reduces overhead and may be less confusing,
0357: since ``minimal_ident`` can get reused.
0358: """
+0359: return 'Greenlet-%d' % (self.minimal_ident,)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_minimal_ident); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Greenlet_d, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0360:
+0361: def _raise_exception(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_5_raise_exception(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_4_raise_exception[] = "Greenlet._raise_exception(self)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_5_raise_exception = {"_raise_exception", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_5_raise_exception, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_4_raise_exception}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_5_raise_exception(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_raise_exception (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_4_raise_exception(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_4_raise_exception(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_raise_exception", 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_AddTraceback("gevent._greenlet.Greenlet._raise_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_5_raise_exception, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet__raise_exception, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_raise_exception, __pyx_t_1) < 0) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_raise_exception, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 361, __pyx_L1_error)
+0362: reraise(*self.exc_info)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exc_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_6gevent_9_greenlet_reraise, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __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;
0363:
0364: @property
+0365: def loop(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_4loop_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_4loop_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_4loop___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_4loop___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._greenlet.Greenlet.loop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0366: # needed by killall
+0367: hub = get_my_hub(self) # type:SwitchOutGreenletWithLoop pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1); __pyx_t_1 = 0;
+0368: return hub.loop
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_hub->loop); __pyx_r = __pyx_v_hub->loop; goto __pyx_L0;
0369:
+0370: def __nonzero__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_9_greenlet_8Greenlet_7__nonzero__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_6gevent_9_greenlet_8Greenlet_7__nonzero__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_6__nonzero__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_9_greenlet_8Greenlet_6__nonzero__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__nonzero__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0371: return self._start_event is not None and self._exc_info is None
__pyx_t_2 = (__pyx_v_self->_start_event != Py_None); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->_exc_info == ((PyObject*)Py_None)); __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; goto __pyx_L0;
+0372: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L8_try_end:; }
+0373: __bool__ = __nonzero__ # Python 3
__Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_bool, __pyx_t_1) < 0) __PYX_ERR(0, 373, __pyx_L3_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
+0374: except NameError: # pragma: no cover
__pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_NameError); if (__pyx_t_9) { __Pyx_ErrRestore(0,0,0); goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:;
0375: # When we're compiled with Cython, the __nonzero__ function
0376: # goes directly into the slot and can't be accessed by name.
0377: pass
0378:
0379: ### Lifecycle
0380:
+0381: if _PYPY:
__pyx_t_3 = (__pyx_v_6gevent_9_greenlet__PYPY != 0); if (__pyx_t_3) { /* … */ goto __pyx_L9; }
0382: # oops - pypy's .dead relies on __nonzero__ which we overriden above
0383: @property
0384: def dead(self):
0385: "Boolean indicating that the greenlet is dead and will not run again."
0386: if self._greenlet__main:
0387: return False
0388: if self.__start_cancelled_by_kill() or self.__started_but_aborted():
0389: return True
0390:
0391: return self._greenlet__started and not _continulet.is_pending(self)
0392: else:
0393: @property
+0394: def dead(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_4dead_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_4dead_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_4dead___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_4dead___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._greenlet.Greenlet.dead.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /*else*/ { } __pyx_L9:;
0395: "Boolean indicating that the greenlet is dead and will not run again."
+0396: return self.__start_cancelled_by_kill() or self.__started_but_aborted() or greenlet.dead.__get__(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___start_cancelled_by_kill(__pyx_v_self); if (!__pyx_t_2) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___started_but_aborted(__pyx_v_self); if (!__pyx_t_2) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_greenlet), __pyx_n_s_dead); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0397:
+0398: def __never_started_or_killed(self):
static int __pyx_f_6gevent_9_greenlet_8Greenlet___never_started_or_killed(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__never_started_or_killed", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0399: return self._start_event is None
__pyx_t_1 = (__pyx_v_self->_start_event == Py_None); __pyx_r = __pyx_t_1; goto __pyx_L0;
0400:
+0401: def __start_pending(self):
static int __pyx_f_6gevent_9_greenlet_8Greenlet___start_pending(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__start_pending", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("gevent._greenlet.Greenlet.__start_pending", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0402: return (self._start_event is not None
__pyx_t_2 = (__pyx_v_self->_start_event != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; }
+0403: and (self._start_event.pending or getattr(self._start_event, 'active', False)))
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_start_event, __pyx_n_s_pending); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } __pyx_t_4 = __pyx_v_self->_start_event; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetAttr3(__pyx_t_4, __pyx_n_s_active, Py_False); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; goto __pyx_L0;
0404:
+0405: def __start_cancelled_by_kill(self):
static int __pyx_f_6gevent_9_greenlet_8Greenlet___start_cancelled_by_kill(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__start_cancelled_by_kill", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0406: return self._start_event is _cancelled_start_event
__pyx_t_1 = (__pyx_v_self->_start_event == ((PyObject *)__pyx_v_6gevent_9_greenlet__cancelled_start_event)); __pyx_r = __pyx_t_1; goto __pyx_L0;
0407:
+0408: def __start_completed(self):
static int __pyx_f_6gevent_9_greenlet_8Greenlet___start_completed(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__start_completed", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0409: return self._start_event is _start_completed_event
__pyx_t_1 = (__pyx_v_self->_start_event == ((PyObject *)__pyx_v_6gevent_9_greenlet__start_completed_event)); __pyx_r = __pyx_t_1; goto __pyx_L0;
0410:
+0411: def __started_but_aborted(self):
static int __pyx_f_6gevent_9_greenlet_8Greenlet___started_but_aborted(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__started_but_aborted", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0412: return (not self.__never_started_or_killed() # we have been started or killed
__pyx_t_2 = ((!(((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___never_started_or_killed(__pyx_v_self) != 0)) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; }
+0413: and not self.__start_cancelled_by_kill() # we weren't killed, so we must have been started
__pyx_t_2 = ((!(((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___start_cancelled_by_kill(__pyx_v_self) != 0)) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; }
+0414: and not self.__start_completed() # the start never completed
__pyx_t_2 = ((!(((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___start_completed(__pyx_v_self) != 0)) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; }
+0415: and not self.__start_pending()) # and we're not pending, so we must have been aborted
__pyx_t_2 = ((!(((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___start_pending(__pyx_v_self) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; goto __pyx_L0;
0416:
+0417: def __cancel_start(self):
static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet___cancel_start(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cancel_start", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._greenlet.Greenlet.__cancel_start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0418: if self._start_event is None:
__pyx_t_1 = (__pyx_v_self->_start_event == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
0419: # prevent self from ever being started in the future
+0420: self._start_event = _cancelled_start_event
__Pyx_INCREF(((PyObject *)__pyx_v_6gevent_9_greenlet__cancelled_start_event)); __Pyx_GIVEREF(((PyObject *)__pyx_v_6gevent_9_greenlet__cancelled_start_event)); __Pyx_GOTREF(__pyx_v_self->_start_event); __Pyx_DECREF(__pyx_v_self->_start_event); __pyx_v_self->_start_event = ((PyObject *)__pyx_v_6gevent_9_greenlet__cancelled_start_event);
0421: # cancel any pending start event
0422: # NOTE: If this was a real pending start event, this will leave a
0423: # "dangling" callback/timer object in the hub.loop.callbacks list;
0424: # depending on where we are in the event loop, it may even be in a local
0425: # variable copy of that list (in _run_callbacks). This isn't a problem,
0426: # except for the leak-tests.
+0427: self._start_event.stop()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_start_event, __pyx_n_s_stop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; 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_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0428: self._start_event.close()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_start_event, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; 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_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0429:
+0430: def __handle_death_before_start(self, args):
static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet___handle_death_before_start(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_args) { PyObject *__pyx_v_arg = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__handle_death_before_start", 0); __Pyx_INCREF(__pyx_v_args); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._greenlet.Greenlet.__handle_death_before_start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_args); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0431: # args is (t, v, tb) or simply t or v
+0432: if self._exc_info is None and self.dead:
__pyx_t_2 = (__pyx_v_self->_exc_info == ((PyObject*)Py_None)); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dead); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
0433: # the greenlet was never switched to before and it will never be, _report_error was not called
0434: # the result was not set and the links weren't notified. let's do it here.
0435: # checking that self.dead is true is essential, because throw() does not necessarily kill the greenlet
0436: # (if the exception raised by throw() is caught somewhere inside the greenlet).
+0437: if len(args) == 1:
if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 437, __pyx_L1_error) } __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 437, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_5 == 1) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L6; }
+0438: arg = args[0]
if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 438, __pyx_L1_error) } __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_arg = __pyx_t_4; __pyx_t_4 = 0;
0439: #if isinstance(arg, type):
+0440: if type(arg) is type(Exception):
__pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_arg)) == ((PyObject *)Py_TYPE(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))))); __pyx_t_3 = (__pyx_t_1 != 0); if (__pyx_t_3) { /* … */ goto __pyx_L7; }
+0441: args = (arg, arg(), None)
__Pyx_INCREF(__pyx_v_arg); __pyx_t_6 = __pyx_v_arg; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_arg); __Pyx_GIVEREF(__pyx_v_arg); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_arg); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_6, 2, Py_None); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_args, ((PyObject*)__pyx_t_6)); __pyx_t_6 = 0;
0442: else:
+0443: args = (type(arg), arg, None)
/*else*/ { __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_arg))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_arg))); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)Py_TYPE(__pyx_v_arg))); __Pyx_INCREF(__pyx_v_arg); __Pyx_GIVEREF(__pyx_v_arg); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_arg); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_6, 2, Py_None); __Pyx_DECREF_SET(__pyx_v_args, ((PyObject*)__pyx_t_6)); __pyx_t_6 = 0; } __pyx_L7:;
+0444: elif not args:
__pyx_t_3 = (__pyx_v_args != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_args) != 0);
__pyx_t_1 = ((!__pyx_t_3) != 0);
if (__pyx_t_1) {
/* … */
}
__pyx_L6:;
+0445: args = (GreenletExit, GreenletExit(), None)
__Pyx_INCREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __pyx_t_4 = __pyx_v_6gevent_9_greenlet_GreenletExit; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __Pyx_GIVEREF(__pyx_v_6gevent_9_greenlet_GreenletExit); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_6gevent_9_greenlet_GreenletExit); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_args, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0;
+0446: self._report_error(args)
__pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_report_error(__pyx_v_self, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0447:
0448: @property
+0449: def started(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_7started_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_7started_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_7started___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_7started___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.Greenlet.started.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0450: # DEPRECATED
+0451: return bool(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 451, __pyx_L1_error) __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0452:
+0453: def ready(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_9_greenlet_8Greenlet_ready(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ready", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ready); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_9ready)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._greenlet.Greenlet.ready", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_8ready[] = "Greenlet.ready(self) -> bool\n\n Return a true value if and only if the greenlet has finished\n execution.\n\n .. versionchanged:: 1.1\n This function is only guaranteed to return true or false *values*, not\n necessarily the literal constants ``True`` or ``False``.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_9ready = {"ready", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_9ready, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_8ready}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ready (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_8ready(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_8ready(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ready", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_9_greenlet_8Greenlet_ready(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __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._greenlet.Greenlet.ready", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_9ready, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_ready, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_ready, __pyx_t_1) < 0) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_ready, 453, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 453, __pyx_L1_error)
0454: """
0455: Return a true value if and only if the greenlet has finished
0456: execution.
0457:
0458: .. versionchanged:: 1.1
0459: This function is only guaranteed to return true or false *values*, not
0460: necessarily the literal constants ``True`` or ``False``.
0461: """
+0462: return self.dead or self._exc_info is not None
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dead); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L3_bool_binop_done; } __pyx_t_6 = (__pyx_v_self->_exc_info != ((PyObject*)Py_None)); __pyx_t_7 = (__pyx_t_6 != 0); __pyx_t_5 = __pyx_t_7; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_5; goto __pyx_L0;
0463:
+0464: def successful(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_11successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_9_greenlet_8Greenlet_successful(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("successful", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_successful); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_11successful)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._greenlet.Greenlet.successful", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_11successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_10successful[] = "Greenlet.successful(self) -> bool\n\n Return a true value if and only if the greenlet has finished execution\n successfully, that is, without raising an error.\n\n .. tip:: A greenlet that has been killed with the default\n :class:`GreenletExit` exception is considered successful.\n That is, ``GreenletExit`` is not considered an error.\n\n .. note:: This function is only guaranteed to return true or false *values*,\n not necessarily the literal constants ``True`` or ``False``.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_11successful = {"successful", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_11successful, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_10successful}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_11successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("successful (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_10successful(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_10successful(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("successful", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_9_greenlet_8Greenlet_successful(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __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._greenlet.Greenlet.successful", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_11successful, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_successful, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_successful, __pyx_t_1) < 0) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_successful, 464, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 464, __pyx_L1_error)
0465: """
0466: Return a true value if and only if the greenlet has finished execution
0467: successfully, that is, without raising an error.
0468:
0469: .. tip:: A greenlet that has been killed with the default
0470: :class:`GreenletExit` exception is considered successful.
0471: That is, ``GreenletExit`` is not considered an error.
0472:
0473: .. note:: This function is only guaranteed to return true or false *values*,
0474: not necessarily the literal constants ``True`` or ``False``.
0475: """
+0476: return self._exc_info is not None and self._exc_info[1] is None
__pyx_t_6 = (__pyx_v_self->_exc_info != ((PyObject*)Py_None)); __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { } else { __pyx_t_5 = __pyx_t_7; goto __pyx_L3_bool_binop_done; } if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 476, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = (__pyx_t_1 == Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_5 = __pyx_t_6; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_5; goto __pyx_L0;
0477:
+0478: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_13__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_13__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_12__repr__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_12__repr__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_v_classname = NULL; PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_formatted = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.Greenlet.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_classname); __Pyx_XDECREF(__pyx_v_name); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_formatted); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0479: classname = self.__class__.__name__
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_classname = __pyx_t_2; __pyx_t_2 = 0;
0480: # If no name has been assigned, don't generate one, including a minimal_ident,
0481: # if not necessary. This reduces the use of weak references and associated
0482: # overhead.
+0483: if 'name' not in self.__dict__ and self._ident is None:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_name_2, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->_ident == Py_None); __pyx_t_4 = (__pyx_t_5 != 0); __pyx_t_3 = __pyx_t_4; __pyx_L4_bool_binop_done:; if (__pyx_t_3) { /* … */ goto __pyx_L3; }
+0484: name = ' '
__Pyx_INCREF(__pyx_kp_s__2);
__pyx_v_name = __pyx_kp_s__2;
0485: else:
+0486: name = ' "%s" ' % (self.name,)
/*else*/ { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_name = __pyx_t_2; __pyx_t_2 = 0; } __pyx_L3:;
+0487: result = '<%s%sat %s' % (classname, name, hex(id(self)))
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_classname); __Pyx_GIVEREF(__pyx_v_classname); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_classname); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_name); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_sat_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0488: formatted = self._formatinfo()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_formatinfo(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_formatted = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0489: if formatted:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_formatted); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 489, __pyx_L1_error) if (__pyx_t_3) { /* … */ }
+0490: result += ': ' + formatted
__pyx_t_1 = PyNumber_Add(__pyx_kp_s__3, __pyx_v_formatted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0;
+0491: return result + '>'
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyNumber_Add(__pyx_v_result, __pyx_kp_s__4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0492:
0493:
+0494: def _formatinfo(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_15_formatinfo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet__formatinfo(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_v_info = NULL; PyObject *__pyx_v_func = NULL; PyObject *__pyx_v_im_self = NULL; PyObject *__pyx_v_funcname = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_args = NULL; PyObject *__pyx_7genexpr__pyx_v_x = NULL; PyObject *__pyx_8genexpr1__pyx_v_key = NULL; PyObject *__pyx_8genexpr1__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_formatinfo", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_formatinfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_15_formatinfo)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 494, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._greenlet.Greenlet._formatinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_info); __Pyx_XDECREF(__pyx_v_func); __Pyx_XDECREF(__pyx_v_im_self); __Pyx_XDECREF(__pyx_v_funcname); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_15_formatinfo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_14_formatinfo[] = "Greenlet._formatinfo(self) -> str"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_15_formatinfo = {"_formatinfo", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_15_formatinfo, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_14_formatinfo}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_15_formatinfo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_formatinfo (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_14_formatinfo(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_14_formatinfo(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_formatinfo", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_8Greenlet__formatinfo(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __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._greenlet.Greenlet._formatinfo", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_15_formatinfo, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet__formatinfo, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_formatinfo, __pyx_t_1) < 0) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_formatinfo, 494, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 494, __pyx_L1_error)
+0495: info = self._formatted_info
__pyx_t_1 = __pyx_v_self->_formatted_info;
__Pyx_INCREF(__pyx_t_1);
__pyx_v_info = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
+0496: if info is not None:
__pyx_t_5 = (__pyx_v_info != ((PyObject*)Py_None)); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+0497: return info
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_info); __pyx_r = __pyx_v_info; goto __pyx_L0;
0498:
0499: # Are we running an arbitrary function provided to the constructor,
0500: # or did a subclass override _run?
+0501: func = self._run
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_func = __pyx_t_1; __pyx_t_1 = 0;
+0502: im_self = getattr(func, '__self__', None)
__pyx_t_1 = __Pyx_GetAttr3(__pyx_v_func, __pyx_n_s_self, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_im_self = __pyx_t_1; __pyx_t_1 = 0;
+0503: if im_self is self:
__pyx_t_6 = (__pyx_v_im_self == ((PyObject *)__pyx_v_self)); __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { /* … */ goto __pyx_L4; }
+0504: funcname = '_run'
__Pyx_INCREF(__pyx_n_s_run_2);
__pyx_v_funcname = __pyx_n_s_run_2;
+0505: elif im_self is not None:
__pyx_t_5 = (__pyx_v_im_self != Py_None); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ goto __pyx_L4; }
+0506: funcname = repr(func)
__pyx_t_1 = PyObject_Repr(__pyx_v_func); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_funcname = __pyx_t_1; __pyx_t_1 = 0;
0507: else:
+0508: funcname = getattr(func, '__name__', '') or repr(func)
/*else*/ { __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_func, __pyx_n_s_name, __pyx_kp_s__5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 508, __pyx_L1_error) if (!__pyx_t_6) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = PyObject_Repr(__pyx_v_func); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_L5_bool_binop_done:; __pyx_v_funcname = __pyx_t_1; __pyx_t_1 = 0; } __pyx_L4:;
0509:
+0510: result = funcname
__Pyx_INCREF(__pyx_v_funcname);
__pyx_v_result = __pyx_v_funcname;
+0511: args = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_args = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0512: if self.args:
__pyx_t_6 = (__pyx_v_self->args != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->args) != 0);
if (__pyx_t_6) {
/* … */
}
+0513: args = [repr(x)[:50] for x in self.args]
{ /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_self->args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 513, __pyx_L10_error) } __pyx_t_2 = __pyx_v_self->args; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; for (;;) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 513, __pyx_L10_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_x, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Repr(__pyx_7genexpr__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 513, __pyx_L10_error) } __pyx_t_4 = PySequence_GetSlice(__pyx_t_3, 0, 50); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 513, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 513, __pyx_L10_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L13_exit_scope; __pyx_L10_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_x); __pyx_7genexpr__pyx_v_x = 0; goto __pyx_L1_error; __pyx_L13_exit_scope:; } /* exit inner scope */ __Pyx_DECREF_SET(__pyx_v_args, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+0514: if self.kwargs:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->kwargs); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 514, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+0515: args.extend(['%s=%s' % (key, repr(value)[:50]) for (key, value) in self.kwargs.items()])
{ /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = 0; if (unlikely(__pyx_v_self->kwargs == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 515, __pyx_L17_error) } __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_self->kwargs, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_4; __pyx_t_4 = 0; while (1) { __pyx_t_10 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_8, &__pyx_t_7, &__pyx_t_4, &__pyx_t_3, NULL, __pyx_t_9); if (unlikely(__pyx_t_10 == 0)) break; if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_key, __pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_value, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Repr(__pyx_8genexpr1__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 515, __pyx_L17_error) } __pyx_t_4 = PySequence_GetSlice(__pyx_t_3, 0, 50); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_8genexpr1__pyx_v_key); __Pyx_GIVEREF(__pyx_8genexpr1__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_8genexpr1__pyx_v_key); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 515, __pyx_L17_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key); __pyx_8genexpr1__pyx_v_key = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value); __pyx_8genexpr1__pyx_v_value = 0; goto __pyx_L20_exit_scope; __pyx_L17_error:; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_key); __pyx_8genexpr1__pyx_v_key = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_value); __pyx_8genexpr1__pyx_v_value = 0; goto __pyx_L1_error; __pyx_L20_exit_scope:; } /* exit inner scope */ __pyx_t_11 = __Pyx_PyList_Extend(__pyx_v_args, __pyx_t_1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0516: if args:
__pyx_t_6 = (PyList_GET_SIZE(__pyx_v_args) != 0);
if (__pyx_t_6) {
/* … */
}
+0517: result += '(' + ', '.join(args) + ')'
__pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_kp_s__6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0;
0518: # it is important to save the result here, because once the greenlet exits '_run' attribute will be removed
+0519: self._formatted_info = result
if (!(likely(PyString_CheckExact(__pyx_v_result))||((__pyx_v_result) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_result)->tp_name), 0))) __PYX_ERR(0, 519, __pyx_L1_error) __pyx_t_2 = __pyx_v_result; __Pyx_INCREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_formatted_info); __Pyx_DECREF(__pyx_v_self->_formatted_info); __pyx_v_self->_formatted_info = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+0520: return result
__Pyx_XDECREF(__pyx_r); if (!(likely(PyString_CheckExact(__pyx_v_result))||((__pyx_v_result) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_result)->tp_name), 0))) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_INCREF(__pyx_v_result); __pyx_r = ((PyObject*)__pyx_v_result); goto __pyx_L0;
0521:
0522: @property
+0523: def exception(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_9exception_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_9exception_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_9exception___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_9exception___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._greenlet.Greenlet.exception.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0524: """
0525: Holds the exception instance raised by the function if the
0526: greenlet has finished with an error. Otherwise ``None``.
0527: """
+0528: return self._exc_info[1] if self._exc_info is not None else None
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_self->_exc_info != ((PyObject*)Py_None)); if ((__pyx_t_2 != 0)) { if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 528, __pyx_L1_error) } __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0529:
0530: @property
+0531: def exc_info(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_8exc_info_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_8exc_info_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_8exc_info___get__(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_8exc_info___get__(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_v_ei = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("gevent._greenlet.Greenlet.exc_info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ei); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0532: """
0533: Holds the exc_info three-tuple raised by the function if the
0534: greenlet finished with an error. Otherwise a false value.
0535:
0536: .. note:: This is a provisional API and may change.
0537:
0538: .. versionadded:: 1.1
0539: """
+0540: ei = self._exc_info
__pyx_t_1 = __pyx_v_self->_exc_info;
__Pyx_INCREF(__pyx_t_1);
__pyx_v_ei = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
+0541: if ei is not None and ei[0] is not None:
__pyx_t_3 = (__pyx_v_ei != ((PyObject*)Py_None)); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } if (unlikely(__pyx_v_ei == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 541, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_ei, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+0542: return (ei[0], ei[1], load_traceback(ei[2]))
__Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_ei == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 542, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_ei, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_ei == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 542, __pyx_L1_error) } __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_ei, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (unlikely(__pyx_v_ei == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 542, __pyx_L1_error) } __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_ei, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_load_traceback); __pyx_t_8 = __pyx_v_6gevent_9_greenlet_load_traceback; __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0;
0543:
+0544: def throw(self, *args):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_17throw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_16throw[] = "Greenlet.throw(self, *args)\nImmediately switch into the greenlet and raise an exception in it.\n\n Should only be called from the HUB, otherwise the current greenlet is left unscheduled forever.\n To raise an exception in a safe manner from any greenlet, use :meth:`kill`.\n\n If a greenlet was started but never switched to yet, then also\n a) cancel the event that will start it\n b) fire the notifications as if an exception was raised in a greenlet\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_17throw = {"throw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_17throw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_16throw}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_17throw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("throw (wrapper)", 0); if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "throw", 0))) return NULL; __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_16throw(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_args); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_16throw(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("throw", 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_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._greenlet.Greenlet.throw", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__33 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_args); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_17throw, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_throw, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_throw, __pyx_t_1) < 0) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_throw, 544, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 544, __pyx_L1_error)
0545: """Immediately switch into the greenlet and raise an exception in it.
0546:
0547: Should only be called from the HUB, otherwise the current greenlet is left unscheduled forever.
0548: To raise an exception in a safe manner from any greenlet, use :meth:`kill`.
0549:
0550: If a greenlet was started but never switched to yet, then also
0551: a) cancel the event that will start it
0552: b) fire the notifications as if an exception was raised in a greenlet
0553: """
+0554: self.__cancel_start()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___cancel_start(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0555:
+0556: try:
/*try:*/ {
+0557: if not self.dead:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dead); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 557, __pyx_L4_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { /* … */ } }
0558: # Prevent switching into a greenlet *at all* if we had never
0559: # started it. Usually this is the same thing that happens by throwing,
0560: # but if this is done from the hub with nothing else running, prevents a
0561: # LoopExit.
+0562: greenlet.throw(self, *args)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_9_greenlet_greenlet), __pyx_n_s_throw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self)); __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_v_args); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 562, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0563: finally:
+0564: self.__handle_death_before_start(args)
/*finally:*/ { /*normal exit:*/{ __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___handle_death_before_start(__pyx_v_self, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __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; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; { __pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___handle_death_before_start(__pyx_v_self, __pyx_v_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); } __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; goto __pyx_L1_error; __pyx_L8_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); } __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; goto __pyx_L1_error; } __pyx_L5:; }
0565:
+0566: def start(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_19start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_18start[] = "Greenlet.start(self)\nSchedule the greenlet to run in this loop iteration"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_19start = {"start", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_19start, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_18start}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_19start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_18start(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_18start(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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_AddTraceback("gevent._greenlet.Greenlet.start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_hub); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_19start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_start, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_start, __pyx_t_1) < 0) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_start, 566, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 566, __pyx_L1_error)
0567: """Schedule the greenlet to run in this loop iteration"""
+0568: if self._start_event is None:
__pyx_t_1 = (__pyx_v_self->_start_event == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0569: _call_spawn_callbacks(self)
__pyx_f_6gevent_9_greenlet__call_spawn_callbacks(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error)
+0570: hub = get_my_hub(self) # type:SwitchOutGreenletWithLoop pylint:disable=undefined-variable
__pyx_t_3 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3); __pyx_t_3 = 0;
+0571: self._start_event = hub.loop.run_callback(self.switch)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_switch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_start_event); __Pyx_DECREF(__pyx_v_self->_start_event); __pyx_v_self->_start_event = __pyx_t_3; __pyx_t_3 = 0;
0572:
+0573: def start_later(self, seconds):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_21start_later(PyObject *__pyx_v_self, PyObject *__pyx_v_seconds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_20start_later[] = "Greenlet.start_later(self, seconds)\n\n start_later(seconds) -> None\n\n Schedule the greenlet to run in the future loop iteration\n *seconds* later\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_21start_later = {"start_later", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_21start_later, METH_O, __pyx_doc_6gevent_9_greenlet_8Greenlet_20start_later}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_21start_later(PyObject *__pyx_v_self, PyObject *__pyx_v_seconds) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_later (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_20start_later(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), ((PyObject *)__pyx_v_seconds)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_20start_later(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_seconds) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start_later", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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_AddTraceback("gevent._greenlet.Greenlet.start_later", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self_2, __pyx_n_s_seconds, __pyx_n_s_hub); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_21start_later, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_start_later, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_start_later, __pyx_t_1) < 0) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_start_later, 573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 573, __pyx_L1_error)
0574: """
0575: start_later(seconds) -> None
0576:
0577: Schedule the greenlet to run in the future loop iteration
0578: *seconds* later
0579: """
+0580: if self._start_event is None:
__pyx_t_1 = (__pyx_v_self->_start_event == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0581: _call_spawn_callbacks(self)
__pyx_f_6gevent_9_greenlet__call_spawn_callbacks(__pyx_v_self); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 581, __pyx_L1_error)
+0582: hub = get_my_hub(self) # pylint:disable=undefined-variable
__pyx_t_3 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 582, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3); __pyx_t_3 = 0;
+0583: self._start_event = hub.loop.timer(seconds)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; 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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_seconds) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_seconds); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_start_event); __Pyx_DECREF(__pyx_v_self->_start_event); __pyx_v_self->_start_event = __pyx_t_3; __pyx_t_3 = 0;
+0584: self._start_event.start(self.switch)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_start_event, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_switch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0585:
+0586: @staticmethod
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_add_spawn_callback, __pyx_t_2) < 0) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
+0587: def add_spawn_callback(callback):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_23add_spawn_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_22add_spawn_callback[] = "Greenlet.add_spawn_callback(callback)\n\n add_spawn_callback(callback) -> None\n\n Set up a *callback* to be invoked when :class:`Greenlet` objects\n are started.\n\n The invocation order of spawn callbacks is unspecified. Adding the\n same callback more than one time will not cause it to be called more\n than once.\n\n .. versionadded:: 1.4.0\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_23add_spawn_callback = {"add_spawn_callback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_23add_spawn_callback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_22add_spawn_callback}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_23add_spawn_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_spawn_callback (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_spawn_callback") < 0)) __PYX_ERR(0, 587, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_callback = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add_spawn_callback", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 587, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.add_spawn_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_22add_spawn_callback(__pyx_v_callback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_22add_spawn_callback(PyObject *__pyx_v_callback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_spawn_callback", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._greenlet.Greenlet.add_spawn_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_23add_spawn_callback, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_add_spawn_callback, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_add_spawn_callback, __pyx_t_1) < 0) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_add_spawn_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_add_spawn_callback, 587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 587, __pyx_L1_error)
0588: """
0589: add_spawn_callback(callback) -> None
0590:
0591: Set up a *callback* to be invoked when :class:`Greenlet` objects
0592: are started.
0593:
0594: The invocation order of spawn callbacks is unspecified. Adding the
0595: same callback more than one time will not cause it to be called more
0596: than once.
0597:
0598: .. versionadded:: 1.4.0
0599: """
0600: global _spawn_callbacks
+0601: if _spawn_callbacks is None: # pylint:disable=used-before-assignment
__pyx_t_1 = (__pyx_v_6gevent_9_greenlet__spawn_callbacks == ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0602: _spawn_callbacks = set()
__pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet__spawn_callbacks); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__spawn_callbacks, ((PyObject*)__pyx_t_3)); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0;
+0603: _spawn_callbacks.add(callback)
if (unlikely(__pyx_v_6gevent_9_greenlet__spawn_callbacks == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add"); __PYX_ERR(0, 603, __pyx_L1_error) } __pyx_t_4 = PySet_Add(__pyx_v_6gevent_9_greenlet__spawn_callbacks, __pyx_v_callback); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 603, __pyx_L1_error)
0604:
+0605: @staticmethod
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_remove_spawn_callback, __pyx_t_1) < 0) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
+0606: def remove_spawn_callback(callback):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_25remove_spawn_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_24remove_spawn_callback[] = "Greenlet.remove_spawn_callback(callback)\n\n remove_spawn_callback(callback) -> None\n\n Remove *callback* function added with :meth:`Greenlet.add_spawn_callback`.\n This function will not fail if *callback* has been already removed or\n if *callback* was never added.\n\n .. versionadded:: 1.4.0\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_25remove_spawn_callback = {"remove_spawn_callback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_25remove_spawn_callback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_24remove_spawn_callback}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_25remove_spawn_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("remove_spawn_callback (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "remove_spawn_callback") < 0)) __PYX_ERR(0, 606, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_callback = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("remove_spawn_callback", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 606, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.remove_spawn_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_24remove_spawn_callback(__pyx_v_callback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_24remove_spawn_callback(PyObject *__pyx_v_callback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("remove_spawn_callback", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.remove_spawn_callback", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_25remove_spawn_callback, __Pyx_CYFUNCTION_STATICMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_remove_spawn_callback, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_remove_spawn_callback, __pyx_t_2) < 0) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); /* … */ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_remove_spawn_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_remove_spawn_callback, 606, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 606, __pyx_L1_error)
0607: """
0608: remove_spawn_callback(callback) -> None
0609:
0610: Remove *callback* function added with :meth:`Greenlet.add_spawn_callback`.
0611: This function will not fail if *callback* has been already removed or
0612: if *callback* was never added.
0613:
0614: .. versionadded:: 1.4.0
0615: """
0616: global _spawn_callbacks
+0617: if _spawn_callbacks is not None:
__pyx_t_1 = (__pyx_v_6gevent_9_greenlet__spawn_callbacks != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0618: _spawn_callbacks.discard(callback)
if (unlikely(__pyx_v_6gevent_9_greenlet__spawn_callbacks == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "discard"); __PYX_ERR(0, 618, __pyx_L1_error) } __pyx_t_3 = __Pyx_PySet_Discard(__pyx_v_6gevent_9_greenlet__spawn_callbacks, __pyx_v_callback); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 618, __pyx_L1_error)
+0619: if not _spawn_callbacks:
__pyx_t_2 = (__pyx_v_6gevent_9_greenlet__spawn_callbacks != Py_None)&&(PySet_GET_SIZE(__pyx_v_6gevent_9_greenlet__spawn_callbacks) != 0);
__pyx_t_1 = ((!__pyx_t_2) != 0);
if (__pyx_t_1) {
/* … */
}
+0620: _spawn_callbacks = None
__Pyx_INCREF(Py_None); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet__spawn_callbacks); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__spawn_callbacks, ((PyObject*)Py_None)); __Pyx_GIVEREF(Py_None);
0621:
+0622: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_spawn, __pyx_t_2) < 0) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
+0623: def spawn(cls, *args, **kwargs):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_27spawn(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_26spawn[] = "Greenlet.spawn(type cls, *args, **kwargs)\n\n spawn(function, *args, **kwargs) -> Greenlet\n\n Create a new :class:`Greenlet` object and schedule it to run ``function(*args, **kwargs)``.\n This can be used as ``gevent.spawn`` or ``Greenlet.spawn``.\n\n The arguments are passed to :meth:`Greenlet.__init__`.\n\n .. versionchanged:: 1.1b1\n If a *function* is given that is not callable, immediately raise a :exc:`TypeError`\n instead of spawning a greenlet that will raise an uncaught TypeError.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_27spawn = {"spawn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_27spawn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_26spawn}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_27spawn(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("spawn (wrapper)", 0); if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "spawn", 1))) return NULL; if (unlikely(__pyx_kwds)) { __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); } else { __pyx_v_kwargs = NULL; } __Pyx_INCREF(__pyx_args); __pyx_v_args = __pyx_args; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_26spawn(((PyTypeObject*)__pyx_v_cls), __pyx_v_args, __pyx_v_kwargs); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_26spawn(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { PyObject *__pyx_v_g = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("spawn", 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._greenlet.Greenlet.spawn", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_g); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_27spawn, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_spawn, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_spawn, __pyx_t_1) < 0) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_spawn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_spawn, 623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 623, __pyx_L1_error)
0624: """
0625: spawn(function, *args, **kwargs) -> Greenlet
0626:
0627: Create a new :class:`Greenlet` object and schedule it to run ``function(*args, **kwargs)``.
0628: This can be used as ``gevent.spawn`` or ``Greenlet.spawn``.
0629:
0630: The arguments are passed to :meth:`Greenlet.__init__`.
0631:
0632: .. versionchanged:: 1.1b1
0633: If a *function* is given that is not callable, immediately raise a :exc:`TypeError`
0634: instead of spawning a greenlet that will raise an uncaught TypeError.
0635: """
+0636: g = cls(*args, **kwargs)
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_g = __pyx_t_1; __pyx_t_1 = 0;
+0637: g.start()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __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;
+0638: return g
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_g); __pyx_r = __pyx_v_g; goto __pyx_L0;
0639:
+0640: @classmethod
__pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_spawn_later, __pyx_t_1) < 0) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet);
+0641: def spawn_later(cls, seconds, *args, **kwargs):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_29spawn_later(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_28spawn_later[] = "Greenlet.spawn_later(type cls, seconds, *args, **kwargs)\n\n spawn_later(seconds, function, *args, **kwargs) -> Greenlet\n\n Create and return a new `Greenlet` object scheduled to run ``function(*args, **kwargs)``\n in a future loop iteration *seconds* later. This can be used as ``Greenlet.spawn_later``\n or ``gevent.spawn_later``.\n\n The arguments are passed to :meth:`Greenlet.__init__`.\n\n .. versionchanged:: 1.1b1\n If an argument that's meant to be a function (the first argument in *args*, or the ``run`` keyword )\n is given to this classmethod (and not a classmethod of a subclass),\n it is verified to be callable. Previously, the spawned greenlet would have failed\n when it started running.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_29spawn_later = {"spawn_later", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_29spawn_later, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_28spawn_later}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_29spawn_later(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_seconds = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("spawn_later (wrapper)", 0); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); if (unlikely(!__pyx_v_args)) { __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_v_args); } else { __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); } { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_seconds,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seconds)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "spawn_later") < 0)) __PYX_ERR(0, 641, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_seconds = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("spawn_later", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 641, __pyx_L3_error) __pyx_L3_error:; __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("gevent._greenlet.Greenlet.spawn_later", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_28spawn_later(((PyTypeObject*)__pyx_v_cls), __pyx_v_seconds, __pyx_v_args, __pyx_v_kwargs); /* function exit code */ __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_28spawn_later(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_seconds, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { PyObject *__pyx_v_g = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("spawn_later", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._greenlet.Greenlet.spawn_later", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__45 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_seconds, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_g); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); /* … */ __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_29spawn_later, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_spawn_later, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_spawn_later, __pyx_t_2) < 0) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); /* … */ __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet, __pyx_n_s_spawn_later); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_spawn_later, 641, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 641, __pyx_L1_error)
0642: """
0643: spawn_later(seconds, function, *args, **kwargs) -> Greenlet
0644:
0645: Create and return a new `Greenlet` object scheduled to run ``function(*args, **kwargs)``
0646: in a future loop iteration *seconds* later. This can be used as ``Greenlet.spawn_later``
0647: or ``gevent.spawn_later``.
0648:
0649: The arguments are passed to :meth:`Greenlet.__init__`.
0650:
0651: .. versionchanged:: 1.1b1
0652: If an argument that's meant to be a function (the first argument in *args*, or the ``run`` keyword )
0653: is given to this classmethod (and not a classmethod of a subclass),
0654: it is verified to be callable. Previously, the spawned greenlet would have failed
0655: when it started running.
0656: """
+0657: if cls is Greenlet and not args and 'run' not in kwargs:
__pyx_t_2 = (__pyx_v_cls == __pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = (PyTuple_GET_SIZE(__pyx_v_args) != 0); __pyx_t_2 = ((!__pyx_t_3) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_run, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 657, __pyx_L1_error) __pyx_t_3 = (__pyx_t_2 != 0); __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* … */ }
+0658: raise TypeError("")
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 658, __pyx_L1_error) /* … */ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s__5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+0659: g = cls(*args, **kwargs)
__pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_g = __pyx_t_4; __pyx_t_4 = 0;
+0660: g.start_later(seconds)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_start_later); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_seconds) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_seconds); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0661: return g
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_g); __pyx_r = __pyx_v_g; goto __pyx_L0;
0662:
+0663: def kill(self, exception=GreenletExit, block=True, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_31kill(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_30kill[] = "Greenlet.kill(self, exception=GreenletExit, block=True, timeout=None)\n\n Raise the ``exception`` in the greenlet.\n\n If ``block`` is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.\n If block is ``False``, the current greenlet is not unscheduled.\n\n The function always returns ``None`` and never raises an error.\n\n .. note::\n\n Depending on what this greenlet is executing and the state\n of the event loop, the exception may or may not be raised\n immediately when this greenlet resumes execution. It may\n be raised on a subsequent green call, or, if this greenlet\n exits before making such a call, it may not be raised at\n all. As of 1.1, an example where the exception is raised\n later is if this greenlet had called :func:`sleep(0)\n <gevent.sleep>`; an example where the exception is raised\n immediately is if this greenlet had called\n :func:`sleep(0.1) <gevent.sleep>`.\n\n .. caution::\n\n Use care when killing greenlets. If the code executing is not\n exception safe (e.g., makes proper use of ``finally``) then an\n unexpected exception could result in corrupted state.\n\n See also :func:`gevent.kill`.\n\n :keyword type exception: The type of exception to raise in the greenlet. The default\n is :class:`GreenletExit`, which indicates a :meth:`successful` completion\n of the greenlet.\n\n .. versionchanged:: 0.13.0\n *block* is now ``True`` by default.\n .. versionchanged:: 1.1a2\n If this greenlet had never been switched to, killing it will prevent it from ever being switched to.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_31kill = {"kill", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_31kill, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_30kill}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_31kill(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_exception = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kill (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exception,&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[3] = {0,0,0}; values[0] = __pyx_k__10; values[1] = ((PyObject *)Py_True); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exception); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "kill") < 0)) __PYX_ERR(0, 663, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_exception = values[0]; __pyx_v_block = values[1]; __pyx_v_timeout = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("kill", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 663, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.kill", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_30kill(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_exception, __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_30kill(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_exception, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_v_waiter = NULL; struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kill", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._greenlet.Greenlet.kill", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_waiter); __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __pyx_k__10 = __pyx_v_6gevent_9_greenlet_GreenletExit; __Pyx_GIVEREF(__pyx_v_6gevent_9_greenlet_GreenletExit); /* … */ __pyx_tuple__47 = PyTuple_Pack(6, __pyx_n_s_self_2, __pyx_n_s_exception, __pyx_n_s_block, __pyx_n_s_timeout, __pyx_n_s_waiter, __pyx_n_s_hub); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_31kill, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_kill, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_kill_2, __pyx_t_1) < 0) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_kill_2, 663, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 663, __pyx_L1_error)
0664: """
0665: Raise the ``exception`` in the greenlet.
0666:
0667: If ``block`` is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
0668: If block is ``False``, the current greenlet is not unscheduled.
0669:
0670: The function always returns ``None`` and never raises an error.
0671:
0672: .. note::
0673:
0674: Depending on what this greenlet is executing and the state
0675: of the event loop, the exception may or may not be raised
0676: immediately when this greenlet resumes execution. It may
0677: be raised on a subsequent green call, or, if this greenlet
0678: exits before making such a call, it may not be raised at
0679: all. As of 1.1, an example where the exception is raised
0680: later is if this greenlet had called :func:`sleep(0)
0681: <gevent.sleep>`; an example where the exception is raised
0682: immediately is if this greenlet had called
0683: :func:`sleep(0.1) <gevent.sleep>`.
0684:
0685: .. caution::
0686:
0687: Use care when killing greenlets. If the code executing is not
0688: exception safe (e.g., makes proper use of ``finally``) then an
0689: unexpected exception could result in corrupted state.
0690:
0691: See also :func:`gevent.kill`.
0692:
0693: :keyword type exception: The type of exception to raise in the greenlet. The default
0694: is :class:`GreenletExit`, which indicates a :meth:`successful` completion
0695: of the greenlet.
0696:
0697: .. versionchanged:: 0.13.0
0698: *block* is now ``True`` by default.
0699: .. versionchanged:: 1.1a2
0700: If this greenlet had never been switched to, killing it will prevent it from ever being switched to.
0701: """
+0702: self.__cancel_start()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___cancel_start(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0703:
+0704: if self.dead:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dead); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ goto __pyx_L3; }
+0705: self.__handle_death_before_start((exception,))
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_exception); __Pyx_GIVEREF(__pyx_v_exception); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exception); __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___handle_death_before_start(__pyx_v_self, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0706: else:
+0707: waiter = Waiter() if block else None # pylint:disable=undefined-variable
/*else*/ { __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 707, __pyx_L1_error) if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { __Pyx_INCREF(Py_None); __pyx_t_3 = Py_None; } __pyx_v_waiter = __pyx_t_3; __pyx_t_3 = 0;
+0708: hub = get_my_hub(self) # pylint:disable=undefined-variable
__pyx_t_3 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3); __pyx_t_3 = 0;
+0709: hub.loop.run_callback(_kill, self, exception, waiter)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_kill); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __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_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_exception, __pyx_v_waiter}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_exception, __pyx_v_waiter}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_exception); __Pyx_GIVEREF(__pyx_v_exception); PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_exception); __Pyx_INCREF(__pyx_v_waiter); __Pyx_GIVEREF(__pyx_v_waiter); PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_waiter); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0710: if waiter is not None:
__pyx_t_2 = (__pyx_v_waiter != Py_None); __pyx_t_8 = (__pyx_t_2 != 0); if (__pyx_t_8) { /* … */ } } __pyx_L3:;
+0711: waiter.get()
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_get_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0712: self.join(timeout)
__pyx_t_9.__pyx_n = 1; __pyx_t_9.timeout = __pyx_v_timeout; __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->join(__pyx_v_self, 0, &__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0713: # it should be OK to use kill() in finally or kill a greenlet from more than one place;
0714: # thus it should not raise when the greenlet is already killed (= not started)
0715:
+0716: def get(self, block=True, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_33get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_32get[] = "Greenlet.get(self, block=True, timeout=None)\n\n get(block=True, timeout=None) -> object\n\n Return the result the greenlet has returned or re-raise the\n exception it has raised.\n\n If block is ``False``, raise :class:`gevent.Timeout` if the\n greenlet is still alive. If block is ``True``, unschedule the\n current greenlet until the result is available or the timeout\n expires. In the latter case, :class:`gevent.Timeout` is\n raised.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_33get = {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_33get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_32get}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_33get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_True); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 716, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_block = values[0]; __pyx_v_timeout = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 716, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_32get(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_32get(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_v_switch = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("gevent._greenlet.Greenlet.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_switch); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__49 = PyTuple_Pack(6, __pyx_n_s_self_2, __pyx_n_s_block, __pyx_n_s_timeout, __pyx_n_s_switch, __pyx_n_s_t, __pyx_n_s_result); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_33get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_get, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_get_2, __pyx_t_1) < 0) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_get_2, 716, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 716, __pyx_L1_error)
0717: """
0718: get(block=True, timeout=None) -> object
0719:
0720: Return the result the greenlet has returned or re-raise the
0721: exception it has raised.
0722:
0723: If block is ``False``, raise :class:`gevent.Timeout` if the
0724: greenlet is still alive. If block is ``True``, unschedule the
0725: current greenlet until the result is available or the timeout
0726: expires. In the latter case, :class:`gevent.Timeout` is
0727: raised.
0728: """
+0729: if self.ready():
__pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0); if (__pyx_t_1) { /* … */ }
+0730: if self.successful():
__pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->successful(__pyx_v_self, 0) != 0); if (__pyx_t_1) { /* … */ }
+0731: return self.value
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->value); __pyx_r = __pyx_v_self->value; goto __pyx_L0;
+0732: self._raise_exception()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0733: if not block:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 733, __pyx_L1_error) __pyx_t_5 = ((!__pyx_t_1) != 0); if (unlikely(__pyx_t_5)) { /* … */ }
+0734: raise Timeout()
__Pyx_INCREF(__pyx_v_6gevent_9_greenlet_Timeout); __pyx_t_3 = __pyx_v_6gevent_9_greenlet_Timeout; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 734, __pyx_L1_error)
0735:
+0736: switch = getcurrent().switch # pylint:disable=undefined-variable
__pyx_t_2 = ((PyObject *)__pyx_f_6gevent_9_greenlet_getcurrent()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_switch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_switch = __pyx_t_3; __pyx_t_3 = 0;
+0737: self.rawlink(switch)
__pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 737, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0738: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L11_try_end:; }
+0739: t = Timeout._start_new_or_dummy(timeout)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_9_greenlet_Timeout, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_timeout); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 739, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0;
+0740: try:
/*try:*/ {
+0741: result = get_my_hub(self).switch()
__pyx_t_3 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 741, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3)->__pyx_vtab)->__pyx_switch(((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_3), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0;
+0742: if result is not self:
__pyx_t_5 = (__pyx_v_result != ((PyObject *)__pyx_v_self)); __pyx_t_1 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_1)) { /* … */ } }
+0743: raise InvalidSwitchError('Invalid switch into Greenlet.get(): %r' % (result, ))
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 743, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_result); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Greenlet_get, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_InvalidSwitchError); __pyx_t_3 = __pyx_v_6gevent_9_greenlet_InvalidSwitchError; __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L13_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 743, __pyx_L13_error)
0744: finally:
+0745: t.cancel()
/*finally:*/ { /*normal exit:*/{ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L14; } __pyx_L13_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 745, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L17_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L6_error; __pyx_L17_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; goto __pyx_L6_error; } __pyx_L14:; }
+0746: except:
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet.Greenlet.get", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 746, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4);
0747: # unlinking in 'except' instead of finally is an optimization:
0748: # if switch occurred normally then link was already removed in _notify_links
0749: # and there's no need to touch the links set.
0750: # Note, however, that if "Invalid switch" assert was removed and invalid switch
0751: # did happen, the link would remain, causing another invalid switch later in this greenlet.
+0752: self.unlink(switch)
__pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 752, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19); if (likely(__pyx_t_20)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); __Pyx_INCREF(__pyx_t_20); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_19, function); } } __pyx_t_9 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_20, __pyx_v_switch) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_v_switch); __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 752, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+0753: raise
__Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_3, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __PYX_ERR(0, 753, __pyx_L8_except_error) } __pyx_L8_except_error:;
0754:
+0755: if self.ready():
__pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0); if (__pyx_t_1) { /* … */ }
+0756: if self.successful():
__pyx_t_1 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->successful(__pyx_v_self, 0) != 0); if (__pyx_t_1) { /* … */ }
+0757: return self.value
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->value); __pyx_r = __pyx_v_self->value; goto __pyx_L0;
+0758: self._raise_exception()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0759:
+0760: def join(self, timeout=None):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_35join(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet_join(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_9_greenlet_8Greenlet_join *__pyx_optional_args) { PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_v_switch = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_ex = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_timeout = __pyx_optional_args->timeout; } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_join); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_35join)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_timeout); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __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_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("gevent._greenlet.Greenlet.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_switch); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_ex); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_35join(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_34join[] = "Greenlet.join(self, timeout=None)\n\n join(timeout=None) -> None\n\n Wait until the greenlet finishes or *timeout* expires. Return\n ``None`` regardless.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_35join = {"join", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_35join, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_34join}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_35join(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "join") < 0)) __PYX_ERR(0, 760, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_timeout = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("join", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 760, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_34join(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_34join(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_9_greenlet_Greenlet->join(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __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._greenlet.Greenlet.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__51); __Pyx_GIVEREF(__pyx_tuple__51); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_35join, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_join, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_join, __pyx_t_1) < 0) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_join, 760, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 760, __pyx_L1_error)
0761: """
0762: join(timeout=None) -> None
0763:
0764: Wait until the greenlet finishes or *timeout* expires. Return
0765: ``None`` regardless.
0766: """
+0767: if self.ready():
__pyx_t_5 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0); if (__pyx_t_5) { /* … */ }
+0768: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
0769:
+0770: switch = getcurrent().switch # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_9_greenlet_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_switch = __pyx_t_2; __pyx_t_2 = 0;
+0771: self.rawlink(switch)
__pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_v_switch, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0772: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L5_exception_handled:; __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L9_try_end:; }
+0773: t = Timeout._start_new_or_dummy(timeout)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_9_greenlet_Timeout, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_timeout); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_t = __pyx_t_2; __pyx_t_2 = 0;
+0774: try:
/*try:*/ {
+0775: result = get_my_hub(self).switch()
__pyx_t_2 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_2)->__pyx_vtab)->__pyx_switch(((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_2), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+0776: if result is not self:
__pyx_t_5 = (__pyx_v_result != ((PyObject *)__pyx_v_self)); __pyx_t_9 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_9)) { /* … */ } }
+0777: raise InvalidSwitchError('Invalid switch into Greenlet.join(): %r' % (result, ))
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_result); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Greenlet_joi, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_InvalidSwitchError); __pyx_t_2 = __pyx_v_6gevent_9_greenlet_InvalidSwitchError; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L11_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, 777, __pyx_L11_error)
0778: finally:
+0779: t.cancel()
/*finally:*/ { /*normal exit:*/{ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L12; } __pyx_L11_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L4_error; __pyx_L15_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; goto __pyx_L4_error; } __pyx_L12:; }
+0780: except Timeout as ex:
__pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_v_6gevent_9_greenlet_Timeout); if (__pyx_t_11) { __Pyx_AddTraceback("gevent._greenlet.Greenlet.join", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 780, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_v_ex = __pyx_t_2; /*try:*/ { /* … */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = NULL; goto __pyx_L22; } __pyx_L21_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_13); __pyx_t_11 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_21 = __pyx_filename; { __Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13); } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_18, __pyx_t_17, __pyx_t_16); __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_21; goto __pyx_L6_except_error; } __pyx_L22:; } __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_L5_exception_handled; }
+0781: self.unlink(switch)
__pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 781, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19); if (likely(__pyx_t_20)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); __Pyx_INCREF(__pyx_t_20); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_19, function); } } __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_20, __pyx_v_switch) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_v_switch); __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0782: if ex is not t:
if (unlikely(!__pyx_v_t)) { __Pyx_RaiseUnboundLocalError("t"); __PYX_ERR(0, 782, __pyx_L21_error) } __pyx_t_9 = (__pyx_v_ex != __pyx_v_t); __pyx_t_5 = (__pyx_t_9 != 0); if (unlikely(__pyx_t_5)) { /* … */ } }
+0783: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __PYX_ERR(0, 783, __pyx_L21_error)
+0784: except:
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet.Greenlet.join", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 784, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1);
+0785: self.unlink(switch)
__pyx_t_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlink); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 785, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_20 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19); if (likely(__pyx_t_20)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); __Pyx_INCREF(__pyx_t_20); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_19, function); } } __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_20, __pyx_v_switch) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_v_switch); __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0786: raise
__Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_1); __Pyx_ErrRestoreWithState(__pyx_t_3, __pyx_t_2, __pyx_t_1); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; __PYX_ERR(0, 786, __pyx_L6_except_error) } __pyx_L6_except_error:;
0787:
+0788: def _report_result(self, result):
static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet__report_result(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_result) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_report_result", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._greenlet.Greenlet._report_result", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0789: self._exc_info = (None, None, None)
__Pyx_INCREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = __pyx_tuple__11; /* … */ __pyx_tuple__11 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 789, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11);
+0790: self.value = result
__Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); __Pyx_GOTREF(__pyx_v_self->value); __Pyx_DECREF(__pyx_v_self->value); __pyx_v_self->value = __pyx_v_result;
+0791: if self._links and not self._notifier:
__pyx_t_2 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 791, __pyx_L1_error) __pyx_t_3 = ((!__pyx_t_2) != 0); __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+0792: hub = get_my_hub(self) # pylint:disable=undefined-variable
__pyx_t_4 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_4); __pyx_t_4 = 0;
+0793: self._notifier = hub.loop.run_callback(self._notify_links)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 793, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 793, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 793, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_notifier); __Pyx_DECREF(__pyx_v_self->_notifier); __pyx_v_self->_notifier = __pyx_t_4; __pyx_t_4 = 0;
0794:
+0795: def _report_error(self, exc_info):
static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet__report_error(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_exc_info) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_report_error", 0); __Pyx_INCREF(__pyx_v_exc_info); /* … */ /* 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("gevent._greenlet.Greenlet._report_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XDECREF(__pyx_v_exc_info); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0796: if isinstance(exc_info[1], GreenletExit):
if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 796, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_6gevent_9_greenlet_GreenletExit; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* … */ }
+0797: self._report_result(exc_info[1])
if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 797, __pyx_L1_error) } __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_report_result(__pyx_v_self, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __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;
+0798: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
0799:
+0800: self._exc_info = exc_info[0], exc_info[1], dump_traceback(exc_info[2])
if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 800, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_exc_info, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 800, __pyx_L1_error) } __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 800, __pyx_L1_error) } __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_exc_info, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_dump_traceback); __pyx_t_7 = __pyx_v_6gevent_9_greenlet_dump_traceback; __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_5); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_7); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0;
0801:
+0802: hub = get_my_hub(self) # pylint:disable=undefined-variable
__pyx_t_7 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_7); __pyx_t_7 = 0;
+0803: if self._links and not self._notifier:
__pyx_t_3 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0); if (__pyx_t_3) { } else { __pyx_t_4 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 803, __pyx_L1_error) __pyx_t_9 = ((!__pyx_t_3) != 0); __pyx_t_4 = __pyx_t_9; __pyx_L5_bool_binop_done:; if (__pyx_t_4) { /* … */ }
+0804: self._notifier = hub.loop.run_callback(self._notify_links)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_7); __Pyx_GOTREF(__pyx_v_self->_notifier); __Pyx_DECREF(__pyx_v_self->_notifier); __pyx_v_self->_notifier = __pyx_t_7; __pyx_t_7 = 0;
0805:
+0806: try:
/*try:*/ {
+0807: hub.handle_error(self, *exc_info)
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_hub), __pyx_n_s_handle_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 807, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)); if (unlikely(__pyx_v_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 807, __pyx_L8_error) } __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_exc_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 807, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; }
0808: finally:
+0809: del exc_info
/*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_exc_info); __pyx_v_exc_info = NULL; goto __pyx_L9; } __pyx_L8_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __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; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { __Pyx_DECREF(__pyx_v_exc_info); __pyx_v_exc_info = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L1_error; } __pyx_L9:; }
0810:
+0811: def run(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_37run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_36run[] = "Greenlet.run(self)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_37run = {"run", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_37run, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_36run}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_37run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("run (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_36run(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_36run(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("run", 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("gevent._greenlet.Greenlet.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_result); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_37run, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_run, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_run, __pyx_t_1) < 0) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_run, 811, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 811, __pyx_L1_error)
+0812: try:
/*try:*/ {
+0813: self.__cancel_start()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->__pyx___cancel_start(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0814: self._start_event = _start_completed_event
__Pyx_INCREF(((PyObject *)__pyx_v_6gevent_9_greenlet__start_completed_event)); __Pyx_GIVEREF(((PyObject *)__pyx_v_6gevent_9_greenlet__start_completed_event)); __Pyx_GOTREF(__pyx_v_self->_start_event); __Pyx_DECREF(__pyx_v_self->_start_event); __pyx_v_self->_start_event = ((PyObject *)__pyx_v_6gevent_9_greenlet__start_completed_event);
0815:
+0816: 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_L11_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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_L4_error; __pyx_L9_except_return:; __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_L3_return; __pyx_L11_try_end:; }
+0817: result = self._run(*self.args, **self.kwargs)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_self->args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 817, __pyx_L6_error) } if (unlikely(__pyx_v_self->kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); __PYX_ERR(0, 817, __pyx_L6_error) } __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_self->args, __pyx_v_self->kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0;
+0818: except: # pylint:disable=bare-except
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet.Greenlet.run", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(0, 818, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_6);
+0819: self._report_error(sys_exc_info())
__Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __pyx_t_8 = __pyx_v_6gevent_9_greenlet_sys_exc_info; __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 819, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (!(likely(PyTuple_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 819, __pyx_L8_except_error) __pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_report_error(__pyx_v_self, ((PyObject*)__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 819, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+0820: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L9_except_return; } __pyx_L8_except_error:;
+0821: self._report_result(result)
__pyx_t_6 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->_report_result(__pyx_v_self, __pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 821, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; }
0822: finally:
+0823: self.__dict__.pop('_run', None)
/*finally:*/ { /*normal exit:*/{ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_run_2, Py_None); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12);
+0824: self.args = ()
__Pyx_INCREF(__pyx_empty_tuple); __Pyx_GIVEREF(__pyx_empty_tuple); __Pyx_GOTREF(__pyx_v_self->args); __Pyx_DECREF(__pyx_v_self->args); __pyx_v_self->args = __pyx_empty_tuple; /* … */ __Pyx_INCREF(__pyx_empty_tuple); __Pyx_GIVEREF(__pyx_empty_tuple); __Pyx_GOTREF(__pyx_v_self->args); __Pyx_DECREF(__pyx_v_self->args); __pyx_v_self->args = __pyx_empty_tuple; /* … */ __Pyx_INCREF(__pyx_empty_tuple); __Pyx_GIVEREF(__pyx_empty_tuple); __Pyx_GOTREF(__pyx_v_self->args); __Pyx_DECREF(__pyx_v_self->args); __pyx_v_self->args = __pyx_empty_tuple;
+0825: self.kwargs.clear()
if (unlikely(__pyx_v_self->kwargs == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear"); __PYX_ERR(0, 825, __pyx_L1_error) } __pyx_t_10 = __Pyx_PyDict_Clear(__pyx_v_self->kwargs); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 825, __pyx_L1_error) goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __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; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { /* … */ if (unlikely(__pyx_v_self->kwargs == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear"); __PYX_ERR(0, 825, __pyx_L15_error) } __pyx_t_10 = __Pyx_PyDict_Clear(__pyx_v_self->kwargs); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 825, __pyx_L15_error) } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2); __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L1_error; __pyx_L15_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_16 = __pyx_r; __pyx_r = 0; /* … */ if (unlikely(__pyx_v_self->kwargs == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear"); __PYX_ERR(0, 825, __pyx_L1_error) } __pyx_t_10 = __Pyx_PyDict_Clear(__pyx_v_self->kwargs); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 825, __pyx_L1_error) __pyx_r = __pyx_t_16; __pyx_t_16 = 0; goto __pyx_L0; } __pyx_L5:; }
0826:
+0827: def _run(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_39_run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_38_run[] = "Greenlet._run(self)\n\n Subclasses may override this method to take any number of\n arguments and keyword arguments.\n\n .. versionadded:: 1.1a3\n Previously, if no callable object was\n passed to the constructor, the spawned greenlet would later\n fail with an AttributeError.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_39_run = {"_run", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_39_run, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_38_run}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_39_run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_run (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_38_run(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_38_run(CYTHON_UNUSED struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_run", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_39_run, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet__run, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_run_2, __pyx_t_1) < 0) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_run_2, 827, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 827, __pyx_L1_error)
0828: """
0829: Subclasses may override this method to take any number of
0830: arguments and keyword arguments.
0831:
0832: .. versionadded:: 1.1a3
0833: Previously, if no callable object was
0834: passed to the constructor, the spawned greenlet would later
0835: fail with an AttributeError.
0836: """
0837: # We usually override this in __init__
0838: # pylint: disable=method-hidden
+0839: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
0840:
+0841: def has_links(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_41has_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_9_greenlet_8Greenlet_has_links(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_links", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_has_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_41has_links)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._greenlet.Greenlet.has_links", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_41has_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_40has_links[] = "Greenlet.has_links(self) -> bool"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_41has_links = {"has_links", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_41has_links, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_40has_links}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_41has_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_links (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_40has_links(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_40has_links(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_links", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_9_greenlet_8Greenlet_has_links(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __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._greenlet.Greenlet.has_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__57); __Pyx_GIVEREF(__pyx_tuple__57); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_41has_links, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_has_links, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_has_links, __pyx_t_1) < 0) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_has_links, 841, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 841, __pyx_L1_error)
+0842: return len(self._links)
__pyx_t_1 = __pyx_v_self->_links; __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 842, __pyx_L1_error) } __pyx_t_6 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_6; goto __pyx_L0;
0843:
+0844: def rawlink(self, callback):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_43rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet_rawlink(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback, int __pyx_skip_dispatch) { struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *__pyx_v_hub = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rawlink", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rawlink); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_43rawlink)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_callback); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __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_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._greenlet.Greenlet.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_hub); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_43rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_42rawlink[] = "Greenlet.rawlink(self, callback)\n\n Register a callable to be executed when the greenlet finishes\n execution.\n\n The *callback* will be called with this instance as an\n argument.\n\n .. caution:: The callable will be called in the HUB greenlet.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_43rawlink = {"rawlink", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_43rawlink, METH_O, __pyx_doc_6gevent_9_greenlet_8Greenlet_42rawlink}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_43rawlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rawlink (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_42rawlink(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_42rawlink(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rawlink", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_8Greenlet_rawlink(__pyx_v_self, __pyx_v_callback, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __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._greenlet.Greenlet.rawlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__59 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__59); __Pyx_GIVEREF(__pyx_tuple__59); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_43rawlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_rawlink, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_rawlink, __pyx_t_1) < 0) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_rawlink, 844, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 844, __pyx_L1_error)
0845: """
0846: Register a callable to be executed when the greenlet finishes
0847: execution.
0848:
0849: The *callback* will be called with this instance as an
0850: argument.
0851:
0852: .. caution:: The callable will be called in the HUB greenlet.
0853: """
+0854: if not callable(callback):
__pyx_t_5 = __Pyx_PyCallable_Check(__pyx_v_callback); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 854, __pyx_L1_error) __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0); if (unlikely(__pyx_t_6)) { /* … */ }
+0855: raise TypeError('Expected callable: %r' % (callback, ))
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_callback); __Pyx_GIVEREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_callback); __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Expected_callable_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __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, 855, __pyx_L1_error)
+0856: self._links.append(callback) # pylint:disable=no-member
if (unlikely(__pyx_v_self->_links == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); __PYX_ERR(0, 856, __pyx_L1_error) } __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->_links, __pyx_v_callback); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 856, __pyx_L1_error)
+0857: if self.ready() and self._links and not self._notifier:
__pyx_t_5 = (((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->ready(__pyx_v_self, 0) != 0); if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_5 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0); if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->_notifier); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 857, __pyx_L1_error) __pyx_t_8 = ((!__pyx_t_5) != 0); __pyx_t_6 = __pyx_t_8; __pyx_L5_bool_binop_done:; if (__pyx_t_6) { /* … */ }
+0858: hub = get_my_hub(self) # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_hub = ((struct __pyx_obj_6gevent_21__greenlet_primitives_SwitchOutGreenletWithLoop *)__pyx_t_1); __pyx_t_1 = 0;
+0859: self._notifier = hub.loop.run_callback(self._notify_links)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_hub->loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_notifier); __Pyx_DECREF(__pyx_v_self->_notifier); __pyx_v_self->_notifier = __pyx_t_1; __pyx_t_1 = 0;
0860:
+0861: def link(self, callback, SpawnedLink=SpawnedLink):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_45link(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_44link[] = "Greenlet.link(self, callback, SpawnedLink=SpawnedLink)\n\n Link greenlet's completion to a callable.\n\n The *callback* will be called with this instance as an\n argument once this greenlet is dead. A callable is called in\n its own :class:`greenlet.greenlet` (*not* a\n :class:`Greenlet`).\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_45link = {"link", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_45link, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_44link}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_45link(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_SpawnedLink = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,&__pyx_n_s_SpawnedLink,0}; PyObject* values[2] = {0,0}; values[1] = __pyx_k__13; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_SpawnedLink); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "link") < 0)) __PYX_ERR(0, 861, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_callback = values[0]; __pyx_v_SpawnedLink = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("link", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 861, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.link", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_44link(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_callback, __pyx_v_SpawnedLink); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_44link(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_SpawnedLink) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link", 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._greenlet.Greenlet.link", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __Pyx_INCREF(((PyObject *)__pyx_ptype_6gevent_9_greenlet_SpawnedLink)); __pyx_k__13 = ((PyObject *)__pyx_ptype_6gevent_9_greenlet_SpawnedLink); __Pyx_GIVEREF(__pyx_ptype_6gevent_9_greenlet_SpawnedLink); /* … */ __pyx_tuple__61 = PyTuple_Pack(3, __pyx_n_s_self_2, __pyx_n_s_callback, __pyx_n_s_SpawnedLink); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__61); __Pyx_GIVEREF(__pyx_tuple__61); __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_45link, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_link, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_link, __pyx_t_1) < 0) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_link, 861, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 861, __pyx_L1_error)
0862: """
0863: Link greenlet's completion to a callable.
0864:
0865: The *callback* will be called with this instance as an
0866: argument once this greenlet is dead. A callable is called in
0867: its own :class:`greenlet.greenlet` (*not* a
0868: :class:`Greenlet`).
0869: """
0870: # XXX: Is the redefinition of SpawnedLink supposed to just be an
0871: # optimization, or do people use it? It's not documented
0872: # pylint:disable=redefined-outer-name
+0873: self.rawlink(SpawnedLink(callback))
__Pyx_INCREF(__pyx_v_SpawnedLink); __pyx_t_2 = __pyx_v_SpawnedLink; __pyx_t_3 = NULL; 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_callback); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_9_greenlet_Greenlet *)__pyx_v_self->__pyx_vtab)->rawlink(__pyx_v_self, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 873, __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;
0874:
+0875: def unlink(self, callback):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_47unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_46unlink[] = "Greenlet.unlink(self, callback)\nRemove the callback set by :meth:`link` or :meth:`rawlink`"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_47unlink = {"unlink", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_47unlink, METH_O, __pyx_doc_6gevent_9_greenlet_8Greenlet_46unlink}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_47unlink(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_46unlink(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), ((PyObject *)__pyx_v_callback)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_46unlink(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._greenlet.Greenlet.unlink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__63 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__63); __Pyx_GIVEREF(__pyx_tuple__63); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_47unlink, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_unlink, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_unlink, __pyx_t_1) < 0) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_unlink, 875, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 875, __pyx_L1_error)
0876: """Remove the callback set by :meth:`link` or :meth:`rawlink`"""
+0877: try:
{ /*try:*/ { /* … */ } __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_L8_try_end; __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_6); __pyx_t_6 = 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_L4_exception_handled:; __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); __pyx_L8_try_end:; }
+0878: self._links.remove(callback) # pylint:disable=no-member
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_links, __pyx_n_s_remove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_callback) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_callback); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0879: except ValueError:
__pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError); if (__pyx_t_7) { __Pyx_ErrRestore(0,0,0); goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:;
0880: pass
0881:
+0882: def unlink_all(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_49unlink_all(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_48unlink_all[] = "Greenlet.unlink_all(self)\n\n Remove all the callbacks.\n\n .. versionadded:: 1.3a2\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_49unlink_all = {"unlink_all", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_49unlink_all, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_48unlink_all}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_49unlink_all(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink_all (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_48unlink_all(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_48unlink_all(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unlink_all", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.unlink_all", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__65); __Pyx_GIVEREF(__pyx_tuple__65); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_49unlink_all, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_unlink_all, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_unlink_all, __pyx_t_1) < 0) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_unlink_all, 882, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 882, __pyx_L1_error)
0883: """
0884: Remove all the callbacks.
0885:
0886: .. versionadded:: 1.3a2
0887: """
+0888: del self._links[:]
if (unlikely(__pyx_v_self->_links == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 888, __pyx_L1_error) } if (__Pyx_PyObject_DelSlice(__pyx_v_self->_links, 0, 0, NULL, NULL, NULL, 0, 0, 1) < 0) __PYX_ERR(0, 888, __pyx_L1_error)
0889:
+0890: def link_value(self, callback, SpawnedLink=SuccessSpawnedLink):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_51link_value(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_50link_value[] = "Greenlet.link_value(self, callback, SpawnedLink=SuccessSpawnedLink)\n\n Like :meth:`link` but *callback* is only notified when the greenlet\n has completed successfully.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_51link_value = {"link_value", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_51link_value, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_50link_value}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_51link_value(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_SpawnedLink = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link_value (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,&__pyx_n_s_SpawnedLink,0}; PyObject* values[2] = {0,0}; values[1] = __pyx_k__14; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_SpawnedLink); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "link_value") < 0)) __PYX_ERR(0, 890, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_callback = values[0]; __pyx_v_SpawnedLink = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("link_value", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 890, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.link_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_50link_value(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_callback, __pyx_v_SpawnedLink); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_50link_value(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_SpawnedLink) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link_value", 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_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._greenlet.Greenlet.link_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __Pyx_INCREF(((PyObject *)__pyx_ptype_6gevent_9_greenlet_SuccessSpawnedLink)); __pyx_k__14 = ((PyObject *)__pyx_ptype_6gevent_9_greenlet_SuccessSpawnedLink); __Pyx_GIVEREF(__pyx_ptype_6gevent_9_greenlet_SuccessSpawnedLink); /* … */ __pyx_tuple__67 = PyTuple_Pack(3, __pyx_n_s_self_2, __pyx_n_s_callback, __pyx_n_s_SpawnedLink); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__67); __Pyx_GIVEREF(__pyx_tuple__67); __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_51link_value, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_link_value, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_link_value, __pyx_t_1) < 0) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_link_value, 890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 890, __pyx_L1_error)
0891: """
0892: Like :meth:`link` but *callback* is only notified when the greenlet
0893: has completed successfully.
0894: """
0895: # pylint:disable=redefined-outer-name
+0896: self.link(callback, SpawnedLink=SpawnedLink)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_link); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_callback); __Pyx_GIVEREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_callback); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_SpawnedLink, __pyx_v_SpawnedLink) < 0) __PYX_ERR(0, 896, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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_4); __pyx_t_4 = 0;
0897:
+0898: def link_exception(self, callback, SpawnedLink=FailureSpawnedLink):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_53link_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_52link_exception[] = "Greenlet.link_exception(self, callback, SpawnedLink=FailureSpawnedLink)\n\n Like :meth:`link` but *callback* is only notified when the\n greenlet dies because of an unhandled exception.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_53link_exception = {"link_exception", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_8Greenlet_53link_exception, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_8Greenlet_52link_exception}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_53link_exception(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_callback = 0; PyObject *__pyx_v_SpawnedLink = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link_exception (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_callback,&__pyx_n_s_SpawnedLink,0}; PyObject* values[2] = {0,0}; values[1] = __pyx_k__15; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_SpawnedLink); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "link_exception") < 0)) __PYX_ERR(0, 898, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_callback = values[0]; __pyx_v_SpawnedLink = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("link_exception", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 898, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.Greenlet.link_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_52link_exception(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self), __pyx_v_callback, __pyx_v_SpawnedLink); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_52link_exception(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, PyObject *__pyx_v_callback, PyObject *__pyx_v_SpawnedLink) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("link_exception", 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_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._greenlet.Greenlet.link_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __Pyx_INCREF(((PyObject *)__pyx_ptype_6gevent_9_greenlet_FailureSpawnedLink)); __pyx_k__15 = ((PyObject *)__pyx_ptype_6gevent_9_greenlet_FailureSpawnedLink); __Pyx_GIVEREF(__pyx_ptype_6gevent_9_greenlet_FailureSpawnedLink); /* … */ __pyx_tuple__69 = PyTuple_Pack(3, __pyx_n_s_self_2, __pyx_n_s_callback, __pyx_n_s_SpawnedLink); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__69); __Pyx_GIVEREF(__pyx_tuple__69); __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_53link_exception, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet_link_exception, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_link_exception, __pyx_t_1) < 0) __PYX_ERR(0, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_link_exception, 898, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 898, __pyx_L1_error)
0899: """
0900: Like :meth:`link` but *callback* is only notified when the
0901: greenlet dies because of an unhandled exception.
0902: """
0903: # pylint:disable=redefined-outer-name
+0904: self.link(callback, SpawnedLink=SpawnedLink)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_link); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_callback); __Pyx_GIVEREF(__pyx_v_callback); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_callback); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_SpawnedLink, __pyx_v_SpawnedLink) < 0) __PYX_ERR(0, 904, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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_4); __pyx_t_4 = 0;
0905:
+0906: def _notify_links(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_55_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_8Greenlet__notify_links(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_v_link = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_notify_links", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_notify_links); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_9_greenlet_8Greenlet_55_notify_links)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __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_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("gevent._greenlet.Greenlet._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_link); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_55_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_8Greenlet_54_notify_links[] = "Greenlet._notify_links(self)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_8Greenlet_55_notify_links = {"_notify_links", (PyCFunction)__pyx_pw_6gevent_9_greenlet_8Greenlet_55_notify_links, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_8Greenlet_54_notify_links}; static PyObject *__pyx_pw_6gevent_9_greenlet_8Greenlet_55_notify_links(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_notify_links (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_8Greenlet_54_notify_links(((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_8Greenlet_54_notify_links(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_notify_links", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_8Greenlet__notify_links(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __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._greenlet.Greenlet._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__71); __Pyx_GIVEREF(__pyx_tuple__71); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_8Greenlet_55_notify_links, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Greenlet__notify_links, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet_Greenlet->tp_dict, __pyx_n_s_notify_links, __pyx_t_1) < 0) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet_Greenlet); __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_notify_links, 906, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 906, __pyx_L1_error)
+0907: while self._links:
while (1) {
__pyx_t_5 = (__pyx_v_self->_links != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->_links) != 0);
if (!__pyx_t_5) break;
0908: # Early links are allowed to remove later links
0909: # before we get to them, and they're also allowed to
0910: # add new links, so we have to be careful about iterating.
0911:
0912: # We don't expect this list to be very large, so the time spent
0913: # manipulating it should be small. a deque is probably not justified.
0914: # Cython has optimizations to transform this into a memmove anyway.
+0915: link = self._links.pop(0)
if (unlikely(__pyx_v_self->_links == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "pop"); __PYX_ERR(0, 915, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyList_PopIndex(__pyx_v_self->_links, __pyx_int_0, 0, 1, Py_ssize_t, PyInt_FromSsize_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_link, __pyx_t_1); __pyx_t_1 = 0;
+0916: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L12_try_end; __pyx_L5_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_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L6_exception_handled:; __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L12_try_end:; } }
+0917: link(self)
__Pyx_INCREF(__pyx_v_link); __pyx_t_2 = __pyx_v_link; __pyx_t_3 = NULL; 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0918: except: # pylint:disable=bare-except, undefined-variable
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet.Greenlet._notify_links", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 918, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
+0919: get_my_hub(self).handle_error((link, self), *sys_exc_info())
__pyx_t_4 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_self))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_handle_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_link); __Pyx_GIVEREF(__pyx_v_link); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_link); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __pyx_t_11 = __pyx_v_6gevent_9_greenlet_sys_exc_info; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L6_exception_handled; } __pyx_L7_except_error:;
0920:
0921:
+0922: class _dummy_event(object):
struct __pyx_vtabstruct_6gevent_9_greenlet__dummy_event { PyObject *(*stop)(struct __pyx_obj_6gevent_9_greenlet__dummy_event *, int __pyx_skip_dispatch); PyObject *(*start)(struct __pyx_obj_6gevent_9_greenlet__dummy_event *, PyObject *, int __pyx_skip_dispatch); PyObject *(*close)(struct __pyx_obj_6gevent_9_greenlet__dummy_event *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_6gevent_9_greenlet__dummy_event *__pyx_vtabptr_6gevent_9_greenlet__dummy_event;
+0923: __slots__ = ('pending', 'active')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event->tp_dict, __pyx_n_s_slots, __pyx_tuple__73) < 0) __PYX_ERR(0, 923, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_9_greenlet__dummy_event); /* … */ __pyx_tuple__73 = PyTuple_Pack(2, __pyx_n_s_pending, __pyx_n_s_active); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__73); __Pyx_GIVEREF(__pyx_tuple__73);
0924:
+0925: def __init__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_9_greenlet_12_dummy_event_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_9_greenlet_12_dummy_event_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __pyx_r = __pyx_pf_6gevent_9_greenlet_12_dummy_event___init__(((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_9_greenlet_12_dummy_event___init__(struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0926: self.pending = self.active = False
__pyx_v_self->pending = 0; __pyx_v_self->active = 0;
0927:
+0928: def stop(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_3stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_12_dummy_event_stop(CYTHON_UNUSED struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("stop", 0); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_3stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_12_dummy_event_2stop[] = "_dummy_event.stop(self)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_12_dummy_event_3stop = {"stop", (PyCFunction)__pyx_pw_6gevent_9_greenlet_12_dummy_event_3stop, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_12_dummy_event_2stop}; static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_3stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("stop (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_12_dummy_event_2stop(((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_12_dummy_event_2stop(struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("stop", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_12_dummy_event_stop(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __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._greenlet._dummy_event.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__74); __Pyx_GIVEREF(__pyx_tuple__74); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_12_dummy_event_3stop, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_dummy_event_stop, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event->tp_dict, __pyx_n_s_stop, __pyx_t_1) < 0) __PYX_ERR(0, 928, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet__dummy_event); __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_stop, 928, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 928, __pyx_L1_error)
0929: pass
0930:
+0931: def start(self, cb): # pylint:disable=unused-argument
static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_5start(PyObject *__pyx_v_self, PyObject *__pyx_v_cb); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_12_dummy_event_start(CYTHON_UNUSED struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_cb, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._greenlet._dummy_event.start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_5start(PyObject *__pyx_v_self, PyObject *__pyx_v_cb); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_12_dummy_event_4start[] = "_dummy_event.start(self, cb)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_12_dummy_event_5start = {"start", (PyCFunction)__pyx_pw_6gevent_9_greenlet_12_dummy_event_5start, METH_O, __pyx_doc_6gevent_9_greenlet_12_dummy_event_4start}; static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_5start(PyObject *__pyx_v_self, PyObject *__pyx_v_cb) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_12_dummy_event_4start(((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_v_self), ((PyObject *)__pyx_v_cb)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_12_dummy_event_4start(struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self, PyObject *__pyx_v_cb) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("start", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_12_dummy_event_start(__pyx_v_self, __pyx_v_cb, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __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._greenlet._dummy_event.start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_self_2, __pyx_n_s_cb); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__76); __Pyx_GIVEREF(__pyx_tuple__76); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_12_dummy_event_5start, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_dummy_event_start, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event->tp_dict, __pyx_n_s_start, __pyx_t_1) < 0) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet__dummy_event); __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_start, 931, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 931, __pyx_L1_error)
+0932: raise AssertionError("Cannot start the dummy event")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_AssertionError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 932, __pyx_L1_error) /* … */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_start_the_dummy_event); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16);
0933:
+0934: def close(self):
static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_7close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_12_dummy_event_close(CYTHON_UNUSED struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_7close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_12_dummy_event_6close[] = "_dummy_event.close(self)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_12_dummy_event_7close = {"close", (PyCFunction)__pyx_pw_6gevent_9_greenlet_12_dummy_event_7close, METH_NOARGS, __pyx_doc_6gevent_9_greenlet_12_dummy_event_6close}; static PyObject *__pyx_pw_6gevent_9_greenlet_12_dummy_event_7close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_9_greenlet_12_dummy_event_6close(((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_12_dummy_event_6close(struct __pyx_obj_6gevent_9_greenlet__dummy_event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet_12_dummy_event_close(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __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._greenlet._dummy_event.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__78 = PyTuple_Pack(1, __pyx_n_s_self_2); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 934, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__78); __Pyx_GIVEREF(__pyx_tuple__78); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_12_dummy_event_7close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_dummy_event_close, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 934, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event->tp_dict, __pyx_n_s_close, __pyx_t_1) < 0) __PYX_ERR(0, 934, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6gevent_9_greenlet__dummy_event); __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_close, 934, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 934, __pyx_L1_error)
0935: pass
0936:
+0937: _cancelled_start_event = _dummy_event()
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 937, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(((PyObject *)__pyx_v_6gevent_9_greenlet__cancelled_start_event)); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__cancelled_start_event, ((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
+0938: _start_completed_event = _dummy_event()
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_9_greenlet__dummy_event)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(((PyObject *)__pyx_v_6gevent_9_greenlet__start_completed_event)); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__start_completed_event, ((struct __pyx_obj_6gevent_9_greenlet__dummy_event *)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0;
0939:
0940:
0941: # This is *only* called as a callback from the hub via Greenlet.kill(),
0942: # and its first argument is the Greenlet. So we can be sure about the types.
+0943: def _kill(glet, exception, waiter):
static PyObject *__pyx_pw_6gevent_9_greenlet_1_kill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet__kill(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_glet, PyObject *__pyx_v_exception, PyObject *__pyx_v_waiter, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_kill", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("gevent._greenlet._kill", __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_9_greenlet_1_kill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet__kill[] = "_kill(Greenlet glet, exception, waiter)"; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_1_kill = {"_kill", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_1_kill, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet__kill}; static PyObject *__pyx_pw_6gevent_9_greenlet_1_kill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_glet = 0; PyObject *__pyx_v_exception = 0; PyObject *__pyx_v_waiter = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_kill (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_glet,&__pyx_n_s_exception,&__pyx_n_s_waiter,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_glet)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exception)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_kill", 1, 3, 3, 1); __PYX_ERR(0, 943, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_waiter)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_kill", 1, 3, 3, 2); __PYX_ERR(0, 943, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_kill") < 0)) __PYX_ERR(0, 943, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_glet = ((struct __pyx_obj_6gevent_9_greenlet_Greenlet *)values[0]); __pyx_v_exception = values[1]; __pyx_v_waiter = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_kill", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 943, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet._kill", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_glet), __pyx_ptype_6gevent_9_greenlet_Greenlet, 1, "glet", 0))) __PYX_ERR(0, 943, __pyx_L1_error) __pyx_r = __pyx_pf_6gevent_9_greenlet__kill(__pyx_self, __pyx_v_glet, __pyx_v_exception, __pyx_v_waiter); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet__kill(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_glet, PyObject *__pyx_v_exception, PyObject *__pyx_v_waiter) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_kill", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_9_greenlet__kill(__pyx_v_glet, __pyx_v_exception, __pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __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._greenlet._kill", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__80 = PyTuple_Pack(3, __pyx_n_s_glet, __pyx_n_s_exception, __pyx_n_s_waiter); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__80); __Pyx_GIVEREF(__pyx_tuple__80); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_1_kill, 0, __pyx_n_s_kill, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_kill, __pyx_t_1) < 0) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_kill, 943, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 943, __pyx_L1_error)
+0944: try:
{ /*try:*/ { /* … */ } __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_L8_try_end; __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_6); __pyx_t_6 = 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_L4_exception_handled:; __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); __pyx_L8_try_end:; }
+0945: glet.throw(exception)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_glet), __pyx_n_s_throw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_exception) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_exception); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0946: except: # pylint:disable=bare-except, undefined-variable
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet._kill", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 946, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6);
0947: # XXX do we need this here?
+0948: get_my_hub(glet).handle_error(glet, *sys_exc_info())
__pyx_t_7 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_glet))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_handle_error); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_glet)); __Pyx_GIVEREF(((PyObject *)__pyx_v_glet)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_glet)); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __pyx_t_10 = __pyx_v_6gevent_9_greenlet_sys_exc_info; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PySequence_Tuple(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 948, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 948, __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_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L4_exception_handled; } __pyx_L5_except_error:;
+0949: if waiter is not None:
__pyx_t_12 = (__pyx_v_waiter != Py_None); __pyx_t_13 = (__pyx_t_12 != 0); if (__pyx_t_13) { /* … */ }
+0950: waiter.switch(None)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_switch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, Py_None) : __Pyx_PyObject_CallOneArg(__pyx_t_5, Py_None); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
0951:
0952:
+0953: def joinall(greenlets, timeout=None, raise_error=False, count=None):
static PyObject *__pyx_pw_6gevent_9_greenlet_3joinall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_9_greenlet_joinall(PyObject *__pyx_v_greenlets, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_9_greenlet_joinall *__pyx_optional_args) { PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_v_raise_error = ((PyObject *)Py_False); PyObject *__pyx_v_count = ((PyObject *)Py_None); PyObject *__pyx_v_done = 0; PyObject *__pyx_v_obj = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("joinall", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_timeout = __pyx_optional_args->timeout; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_raise_error = __pyx_optional_args->raise_error; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_count = __pyx_optional_args->count; } } } } /* … */ /* 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_8); __Pyx_AddTraceback("gevent._greenlet.joinall", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_done); __Pyx_XDECREF(__pyx_v_obj); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_3joinall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_2joinall[] = "joinall(greenlets, timeout=None, raise_error=False, count=None)\n\n Wait for the ``greenlets`` to finish.\n\n :param greenlets: A sequence (supporting :func:`len`) of greenlets to wait for.\n :keyword float timeout: If given, the maximum number of seconds to wait.\n :return: A sequence of the greenlets that finished before the timeout (if any)\n expired.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_3joinall = {"joinall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_3joinall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_2joinall}; static PyObject *__pyx_pw_6gevent_9_greenlet_3joinall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_greenlets = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_v_raise_error = 0; PyObject *__pyx_v_count = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("joinall (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_greenlets,&__pyx_n_s_timeout,&__pyx_n_s_raise_error,&__pyx_n_s_count,0}; PyObject* values[4] = {0,0,0,0}; values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_False); values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_greenlets)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_raise_error); if (value) { values[2] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "joinall") < 0)) __PYX_ERR(0, 953, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_greenlets = values[0]; __pyx_v_timeout = values[1]; __pyx_v_raise_error = values[2]; __pyx_v_count = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("joinall", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 953, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.joinall", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_2joinall(__pyx_self, __pyx_v_greenlets, __pyx_v_timeout, __pyx_v_raise_error, __pyx_v_count); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_2joinall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_greenlets, PyObject *__pyx_v_timeout, PyObject *__pyx_v_raise_error, PyObject *__pyx_v_count) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("joinall", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 3; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_2.raise_error = __pyx_v_raise_error; __pyx_t_2.count = __pyx_v_count; __pyx_t_1 = __pyx_f_6gevent_9_greenlet_joinall(__pyx_v_greenlets, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __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._greenlet.joinall", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__82 = PyTuple_Pack(4, __pyx_n_s_greenlets, __pyx_n_s_timeout, __pyx_n_s_raise_error, __pyx_n_s_count); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__82); __Pyx_GIVEREF(__pyx_tuple__82); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_3joinall, 0, __pyx_n_s_joinall, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_joinall, __pyx_t_1) < 0) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_greenlet_py, __pyx_n_s_joinall, 953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 953, __pyx_L1_error)
0954: """
0955: Wait for the ``greenlets`` to finish.
0956:
0957: :param greenlets: A sequence (supporting :func:`len`) of greenlets to wait for.
0958: :keyword float timeout: If given, the maximum number of seconds to wait.
0959: :return: A sequence of the greenlets that finished before the timeout (if any)
0960: expired.
0961: """
+0962: if not raise_error:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_raise_error); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 962, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { /* … */ }
+0963: return wait(greenlets, timeout=timeout, count=count)
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_greenlets); __Pyx_GIVEREF(__pyx_v_greenlets); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_greenlets); __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(0, 963, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_count, __pyx_v_count) < 0) __PYX_ERR(0, 963, __pyx_L1_error) __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_6gevent_9_greenlet_wait, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
0964:
+0965: done = []
__pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_done = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
+0966: for obj in iwait(greenlets, timeout=timeout, count=count):
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_greenlets); __Pyx_GIVEREF(__pyx_v_greenlets); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_greenlets); __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(0, 966, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_count, __pyx_v_count) < 0) __PYX_ERR(0, 966, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_6gevent_9_greenlet_iwait, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __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_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 966, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 966, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 966, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_7(__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, 966, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_3); __pyx_t_3 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0967: if getattr(obj, 'exception', None) is not None:
__pyx_t_3 = __Pyx_GetAttr3(__pyx_v_obj, __pyx_n_s_exception, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = (__pyx_t_3 != Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+0968: if hasattr(obj, '_raise_exception'):
__pyx_t_1 = __Pyx_HasAttr(__pyx_v_obj, __pyx_n_s_raise_exception); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 968, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (likely(__pyx_t_2)) { /* … */ goto __pyx_L7; }
+0969: obj._raise_exception()
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_raise_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0970: else:
+0971: raise obj.exception
/*else*/ { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 971, __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, 971, __pyx_L1_error) } __pyx_L7:;
+0972: done.append(obj)
__pyx_t_9 = __Pyx_PyList_Append(__pyx_v_done, __pyx_v_obj); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 972, __pyx_L1_error)
+0973: return done
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_done); __pyx_r = __pyx_v_done; goto __pyx_L0;
0974:
0975:
+0976: def _killall3(greenlets, exception, waiter):
static PyObject *__pyx_f_6gevent_9_greenlet__killall3(PyObject *__pyx_v_greenlets, PyObject *__pyx_v_exception, PyObject *__pyx_v_waiter) { PyObject *__pyx_v_diehards = 0; PyObject *__pyx_v_g = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_killall3", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("gevent._greenlet._killall3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_diehards); __Pyx_XDECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0977: diehards = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_diehards = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0978: for g in greenlets:
if (unlikely(__pyx_v_greenlets == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 978, __pyx_L1_error) } __pyx_t_1 = __pyx_v_greenlets; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 978, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_g, __pyx_t_3); __pyx_t_3 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0979: if not g.dead:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_dead); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 979, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = ((!__pyx_t_4) != 0); if (__pyx_t_5) { /* … */ }
+0980: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L13_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L13_try_end:; }
+0981: g.throw(exception)
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_throw); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 981, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_exception) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_exception); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 981, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0982: except: # pylint:disable=bare-except, undefined-variable
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet._killall3", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 982, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10);
+0983: get_my_hub(g).handle_error(g, *sys_exc_info())
if (!(likely(((__pyx_v_g) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_g, __pyx_ptype_6gevent_9_greenlet_greenlet))))) __PYX_ERR(0, 983, __pyx_L8_except_error) __pyx_t_11 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_g))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_handle_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_g); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __pyx_t_14 = __pyx_v_6gevent_9_greenlet_sys_exc_info; __pyx_t_15 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_14, function); } } __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PySequence_Tuple(__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyNumber_Add(__pyx_t_11, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 983, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L7_exception_handled; } __pyx_L8_except_error:;
+0984: if not g.dead:
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_dead); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 984, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 984, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_4 = ((!__pyx_t_5) != 0); if (__pyx_t_4) { /* … */ }
+0985: diehards.append(g)
__pyx_t_16 = __Pyx_PyList_Append(__pyx_v_diehards, __pyx_v_g); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 985, __pyx_L1_error)
+0986: waiter.switch(diehards)
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_n_s_switch); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 986, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_v_diehards) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_diehards); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0987:
0988:
+0989: def _killall(greenlets, exception):
static PyObject *__pyx_f_6gevent_9_greenlet__killall(PyObject *__pyx_v_greenlets, PyObject *__pyx_v_exception) { PyObject *__pyx_v_g = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_killall", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("gevent._greenlet._killall", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0990: for g in greenlets:
if (unlikely(__pyx_v_greenlets == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 990, __pyx_L1_error) } __pyx_t_1 = __pyx_v_greenlets; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 990, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_g, __pyx_t_3); __pyx_t_3 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0991: if not g.dead:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_dead); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 991, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 991, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = ((!__pyx_t_4) != 0); if (__pyx_t_5) { /* … */ }
+0992: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L13_try_end; __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L7_exception_handled:; __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); __pyx_L13_try_end:; }
+0993: g.throw(exception)
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_throw); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 993, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_v_exception) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_exception); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0994: except: # pylint:disable=bare-except, undefined-variable
/*except:*/ { __Pyx_AddTraceback("gevent._greenlet._killall", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 994, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10);
+0995: get_my_hub(g).handle_error(g, *sys_exc_info())
if (!(likely(((__pyx_v_g) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_g, __pyx_ptype_6gevent_9_greenlet_greenlet))))) __PYX_ERR(0, 995, __pyx_L8_except_error) __pyx_t_11 = ((PyObject *)__pyx_f_6gevent_9_greenlet_get_my_hub(((PyGreenlet *)__pyx_v_g))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_handle_error); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_g); __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_sys_exc_info); __pyx_t_14 = __pyx_v_6gevent_9_greenlet_sys_exc_info; __pyx_t_15 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14); if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_14, function); } } __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PySequence_Tuple(__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyNumber_Add(__pyx_t_11, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 995, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L7_exception_handled; } __pyx_L8_except_error:;
0996:
0997:
+0998: def _call_spawn_callbacks(gr):
static void __pyx_f_6gevent_9_greenlet__call_spawn_callbacks(struct __pyx_obj_6gevent_9_greenlet_Greenlet *__pyx_v_gr) { PyObject *__pyx_v_cb = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_call_spawn_callbacks", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("gevent._greenlet._call_spawn_callbacks", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_cb); __Pyx_RefNannyFinishContext(); }
+0999: if _spawn_callbacks is not None:
__pyx_t_1 = (__pyx_v_6gevent_9_greenlet__spawn_callbacks != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+1000: for cb in _spawn_callbacks:
__pyx_t_4 = 0; __pyx_t_7 = __Pyx_set_iterator(__pyx_v_6gevent_9_greenlet__spawn_callbacks, 1, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1000, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; while (1) { __pyx_t_8 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, __pyx_t_6); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 1000, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_cb, __pyx_t_7); __pyx_t_7 = 0;
+1001: cb(gr)
__Pyx_INCREF(__pyx_v_cb); __pyx_t_9 = __pyx_v_cb; __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, ((PyObject *)__pyx_v_gr)) : __Pyx_PyObject_CallOneArg(__pyx_t_9, ((PyObject *)__pyx_v_gr)); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1001, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1002:
1003:
+1004: _spawn_callbacks = None
__Pyx_INCREF(Py_None); __Pyx_XGOTREF(__pyx_v_6gevent_9_greenlet__spawn_callbacks); __Pyx_DECREF_SET(__pyx_v_6gevent_9_greenlet__spawn_callbacks, ((PyObject*)Py_None)); __Pyx_GIVEREF(Py_None);
1005:
1006:
+1007: def killall(greenlets, exception=GreenletExit, block=True, timeout=None):
static PyObject *__pyx_pf_6gevent_9_greenlet_11__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_exception); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_exception); PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_exception); __Pyx_INCREF(((PyObject *)Py_True)); __Pyx_GIVEREF(((PyObject *)Py_True)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_True)); __Pyx_INCREF(((PyObject *)Py_None)); __Pyx_GIVEREF(((PyObject *)Py_None)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None)); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._greenlet.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_9_greenlet_5killall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_9_greenlet_4killall[] = "killall(greenlets, exception=GreenletExit, block=True, timeout=None)\n\n Forceably terminate all the ``greenlets`` by causing them to raise ``exception``.\n\n .. caution:: Use care when killing greenlets. If they are not prepared for exceptions,\n this could result in corrupted state.\n\n :param greenlets: A **bounded** iterable of the non-None greenlets to terminate.\n *All* the items in this iterable must be greenlets that belong to the same hub,\n which should be the hub for this current thread.\n :keyword exception: The exception to raise in the greenlets. By default this is\n :class:`GreenletExit`.\n :keyword bool block: If True (the default) then this function only returns when all the\n greenlets are dead; the current greenlet is unscheduled during that process.\n If greenlets ignore the initial exception raised in them,\n then they will be joined (with :func:`gevent.joinall`) and allowed to die naturally.\n If False, this function returns immediately and greenlets will raise\n the exception asynchronously.\n :keyword float timeout: A time in seconds to wait for greenlets to die. If given, it is\n only honored when ``block`` is True.\n :raise Timeout: If blocking and a timeout is given that elapses before\n all the greenlets are dead.\n\n .. versionchanged:: 1.1a2\n *greenlets* can be any iterable of greenlets, like an iterator or a set.\n Previously it had to be a list or tuple.\n "; static PyMethodDef __pyx_mdef_6gevent_9_greenlet_5killall = {"killall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_9_greenlet_5killall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_9_greenlet_4killall}; static PyObject *__pyx_pw_6gevent_9_greenlet_5killall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_greenlets = 0; PyObject *__pyx_v_exception = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("killall (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_greenlets,&__pyx_n_s_exception,&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[4] = {0,0,0,0}; __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self); values[1] = __pyx_dynamic_args->__pyx_arg_exception; values[2] = ((PyObject *)((PyObject *)Py_True)); values[3] = ((PyObject *)((PyObject *)Py_None)); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_greenlets)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exception); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[2] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "killall") < 0)) __PYX_ERR(0, 1007, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_greenlets = values[0]; __pyx_v_exception = values[1]; __pyx_v_block = values[2]; __pyx_v_timeout = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("killall", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1007, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._greenlet.killall", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_9_greenlet_4killall(__pyx_self, __pyx_v_greenlets, __pyx_v_exception, __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_9_greenlet_4killall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_greenlets, PyObject *__pyx_v_exception, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_v_loop = NULL; struct __pyx_obj_6gevent_8__waiter_Waiter *__pyx_v_waiter = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_alive = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("killall", 0); __Pyx_INCREF(__pyx_v_greenlets); /* … */ /* 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_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("gevent._greenlet.killall", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_loop); __Pyx_XDECREF((PyObject *)__pyx_v_waiter); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_alive); __Pyx_XDECREF(__pyx_v_greenlets); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__84 = PyTuple_Pack(8, __pyx_n_s_greenlets, __pyx_n_s_exception, __pyx_n_s_block, __pyx_n_s_timeout, __pyx_n_s_loop, __pyx_n_s_waiter, __pyx_n_s_t, __pyx_n_s_alive); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__84); __Pyx_GIVEREF(__pyx_tuple__84); /* … */ __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_9_greenlet_5killall, 0, __pyx_n_s_killall, NULL, __pyx_n_s_gevent__greenlet, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_INCREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_exception = __pyx_v_6gevent_9_greenlet_GreenletExit; __Pyx_GIVEREF(__pyx_v_6gevent_9_greenlet_GreenletExit); __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_6gevent_9_greenlet_11__defaults__); if (PyDict_SetItem(__pyx_d, __pyx_n_s_killall, __pyx_t_1) < 0) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1008: """
1009: Forceably terminate all the ``greenlets`` by causing them to raise ``exception``.
1010:
1011: .. caution:: Use care when killing greenlets. If they are not prepared for exceptions,
1012: this could result in corrupted state.
1013:
1014: :param greenlets: A **bounded** iterable of the non-None greenlets to terminate.
1015: *All* the items in this iterable must be greenlets that belong to the same hub,
1016: which should be the hub for this current thread.
1017: :keyword exception: The exception to raise in the greenlets. By default this is
1018: :class:`GreenletExit`.
1019: :keyword bool block: If True (the default) then this function only returns when all the
1020: greenlets are dead; the current greenlet is unscheduled during that process.
1021: If greenlets ignore the initial exception raised in them,
1022: then they will be joined (with :func:`gevent.joinall`) and allowed to die naturally.
1023: If False, this function returns immediately and greenlets will raise
1024: the exception asynchronously.
1025: :keyword float timeout: A time in seconds to wait for greenlets to die. If given, it is
1026: only honored when ``block`` is True.
1027: :raise Timeout: If blocking and a timeout is given that elapses before
1028: all the greenlets are dead.
1029:
1030: .. versionchanged:: 1.1a2
1031: *greenlets* can be any iterable of greenlets, like an iterator or a set.
1032: Previously it had to be a list or tuple.
1033: """
1034: # support non-indexable containers like iterators or set objects
+1035: greenlets = list(greenlets)
__pyx_t_1 = PySequence_List(__pyx_v_greenlets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_greenlets, __pyx_t_1); __pyx_t_1 = 0;
+1036: if not greenlets:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_greenlets); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1036, __pyx_L1_error) __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { /* … */ }
+1037: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+1038: loop = greenlets[0].loop
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_greenlets, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_loop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_loop = __pyx_t_4; __pyx_t_4 = 0;
+1039: if block:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1039, __pyx_L1_error) if (__pyx_t_3) { /* … */ goto __pyx_L4; }
+1040: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1040, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_waiter = ((struct __pyx_obj_6gevent_8__waiter_Waiter *)__pyx_t_4); __pyx_t_4 = 0;
+1041: loop.run_callback(_killall3, greenlets, exception, waiter)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_CFunc_object____list____object____object___to_py(__pyx_f_6gevent_9_greenlet__killall3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_greenlets, __pyx_v_exception, ((PyObject *)__pyx_v_waiter)}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_greenlets, __pyx_v_exception, ((PyObject *)__pyx_v_waiter)}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5); __Pyx_INCREF(__pyx_v_greenlets); __Pyx_GIVEREF(__pyx_v_greenlets); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_greenlets); __Pyx_INCREF(__pyx_v_exception); __Pyx_GIVEREF(__pyx_v_exception); PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_exception); __Pyx_INCREF(((PyObject *)__pyx_v_waiter)); __Pyx_GIVEREF(((PyObject *)__pyx_v_waiter)); PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, ((PyObject *)__pyx_v_waiter)); __pyx_t_5 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+1042: t = Timeout._start_new_or_dummy(timeout)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_6gevent_9_greenlet_Timeout, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1042, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_timeout) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_timeout); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1042, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_t = __pyx_t_4; __pyx_t_4 = 0;
+1043: try:
/*try:*/ {
+1044: alive = waiter.get()
__pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_8__waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1044, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_alive = __pyx_t_4; __pyx_t_4 = 0;
+1045: if alive:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_alive); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1045, __pyx_L6_error) if (__pyx_t_3) { /* … */ } }
+1046: joinall(alive, raise_error=False)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_joinall); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1046, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1046, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_alive); __Pyx_GIVEREF(__pyx_v_alive); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_alive); __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1046, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_raise_error, Py_False) < 0) __PYX_ERR(0, 1046, __pyx_L6_error) __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1046, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1047: finally:
+1048: t.cancel()
/*finally:*/ { /*normal exit:*/{ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1048, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L7; } __pyx_L6_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __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; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __pyx_t_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_cancel); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1048, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_8); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13); __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10; goto __pyx_L1_error; __pyx_L10_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; goto __pyx_L1_error; } __pyx_L7:; }
1049: else:
+1050: loop.run_callback(_killall, greenlets, exception)
/*else*/ { __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_1 = __Pyx_CFunc_object____list____object___to_py(__pyx_f_6gevent_9_greenlet__killall); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_1, __pyx_v_greenlets, __pyx_v_exception}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_1, __pyx_v_greenlets, __pyx_v_exception}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { __pyx_t_6 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_9, __pyx_t_1); __Pyx_INCREF(__pyx_v_greenlets); __Pyx_GIVEREF(__pyx_v_greenlets); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_9, __pyx_v_greenlets); __Pyx_INCREF(__pyx_v_exception); __Pyx_GIVEREF(__pyx_v_exception); PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_9, __pyx_v_exception); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_L4:;
1051:
+1052: def _init():
static void __pyx_f_6gevent_9_greenlet__init(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+1053: greenlet_init() # pylint:disable=undefined-variable
__pyx_f_6gevent_9_greenlet_greenlet_init();
1054:
+1055: _init()
__pyx_f_6gevent_9_greenlet__init();
1056:
+1057: from gevent._util import import_c_accel
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_import_c_accel); __Pyx_GIVEREF(__pyx_n_s_import_c_accel); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_import_c_accel); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_1) < 0) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1058: import_c_accel(globals(), 'gevent._greenlet')
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_INCREF(__pyx_n_s_gevent__greenlet); __Pyx_GIVEREF(__pyx_n_s_gevent__greenlet); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_gevent__greenlet); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;