Generated by Cython 3.0a5
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: event.c
+001: # Copyright (c) 2009-2016 Denis Bilenko, gevent contributors. See LICENSE for details.
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; }
002: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False,infer_types=True
003:
004: """Basic synchronization primitives: Event and AsyncResult"""
005: from __future__ import print_function
006:
+007: from gevent._util import _NONE
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_NONE); __Pyx_GIVEREF(__pyx_n_s_NONE); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_NONE); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __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_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 7, __pyx_L1_error) #endif if (PyDict_SetItem(__pyx_d, __pyx_n_s_NONE, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+008: from gevent._compat import reraise
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __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, 8, __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, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cevent_reraise); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cevent_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;
+009: from gevent._tblib import dump_traceback, load_traceback
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_dump_traceback); __Pyx_GIVEREF(__pyx_n_s_dump_traceback); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dump_traceback); __Pyx_INCREF(__pyx_n_s_load_traceback); __Pyx_GIVEREF(__pyx_n_s_load_traceback); PyList_SET_ITEM(__pyx_t_1, 1, __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, 9, __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_dump_traceback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cevent_dump_traceback); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cevent_dump_traceback, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __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, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cevent_load_traceback); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cevent_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;
010:
+011: from gevent.timeout import Timeout
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_Timeout); __Pyx_GIVEREF(__pyx_n_s_Timeout); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Timeout); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent_timeout, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __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_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cevent_Timeout); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cevent_Timeout, __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;
012:
013:
+014: __all__ = [
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Event); __Pyx_GIVEREF(__pyx_n_s_Event); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Event); __Pyx_INCREF(__pyx_n_s_AsyncResult); __Pyx_GIVEREF(__pyx_n_s_AsyncResult); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_AsyncResult); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 14, __pyx_L1_error) #endif if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; }
015: 'Event',
016: 'AsyncResult',
017: ]
018:
+019: def _get_linkable():
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_1_get_linkable(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent__get_linkable, "_get_linkable()"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_1_get_linkable = {"_get_linkable", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_1_get_linkable, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent__get_linkable}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_1_get_linkable(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_linkable (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent__get_linkable(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent__get_linkable(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_v_x = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_linkable", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._gevent_cevent._get_linkable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 19, __pyx_L1_error); #endif __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_1_get_linkable, 0, __pyx_n_s_get_linkable, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__3)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 19, __pyx_L1_error) #endif if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_linkable, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_get_linkable, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 19, __pyx_L1_error)
+020: x = __import__('gevent._abstract_linkable')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin___import__, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_x = __pyx_t_1; __pyx_t_1 = 0; /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_gevent__abstract_linkable); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
+021: return x._abstract_linkable.AbstractLinkable
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_abstract_linkable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AbstractLinkable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __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;
+022: locals()['AbstractLinkable'] = _get_linkable()
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_linkable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); 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_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_AbstractLinkable, __pyx_t_2) < 0)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+023: del _get_linkable
if (__Pyx_PyObject_DelAttrStr(__pyx_m, __pyx_n_s_get_linkable) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
024:
025:
+026: class Event(AbstractLinkable): # pylint:disable=undefined-variable
struct __pyx_vtabstruct_6gevent_14_gevent_cevent_Event { struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable __pyx_base; }; static struct __pyx_vtabstruct_6gevent_14_gevent_cevent_Event *__pyx_vtabptr_6gevent_14_gevent_cevent_Event;
027: """
028: A synchronization primitive that allows one greenlet to wake up
029: one or more others. It has the same interface as
030: :class:`threading.Event` but works across greenlets.
031:
032: An event object manages an internal flag that can be set to true
033: with the :meth:`set` method and reset to false with the
034: :meth:`clear` method. The :meth:`wait` method blocks until the
035: flag is true; as soon as the flag is set to true, all greenlets
036: that are currently blocked in a call to :meth:`wait` will be scheduled
037: to awaken.
038:
039: Note that the flag may be cleared and set many times before
040: any individual greenlet runs; all the greenlet can know for sure is that the
041: flag was set *at least once* while it was waiting.
042: If the greenlet cares whether the flag is still
043: set, it must check with :meth:`ready` and possibly call back into
044: :meth:`wait` again.
045:
046: .. note::
047:
048: The exact order and timing in which waiting greenlets are awakened is not determined.
049:
050: Once the event is set, other greenlets may run before any waiting greenlets
051: are awakened.
052:
053: While the code here will awaken greenlets in the order in which they
054: waited, each such greenlet that runs may in turn cause other greenlets
055: to run.
056:
057: These details may change in the future.
058:
059: .. versionchanged:: 1.5a3
060:
061: Waiting greenlets are now awakened in
062: the order in which they waited.
063:
064: .. versionchanged:: 1.5a3
065:
066: The low-level ``rawlink`` method (most users won't use this) now
067: automatically unlinks waiters before calling them.
068:
069: .. versionchanged:: 20.5.1
070:
071: Callers to ``wait`` that find the event already set will now run
072: after any other waiters that had to block. See :issue:`1520`.
073: """
074:
+075: __slots__ = ('_flag',)
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_slots, __pyx_tuple__4) < 0) __PYX_ERR(0, 75, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); /* … */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_flag); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4);
076:
+077: def __init__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_cevent_5Event_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_cevent_5Event_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event___init__(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_cevent_5Event___init__(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { 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_AddTraceback("gevent._gevent_cevent.Event.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+078: super(Event, self).__init__()
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event); __Pyx_GIVEREF((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event)); __Pyx_INCREF((PyObject *)__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_3, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __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;
+079: self._flag = False
__pyx_v_self->_flag = 0;
080:
+081: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_3__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_3__str__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_2__str__(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_2__str__(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__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_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_cevent.Event.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+082: return '<%s %s _links[%s]>' % (
__Pyx_XDECREF(__pyx_r); /* … */ __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_s__links_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+083: 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, 83, __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, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0;
+084: 'set' if self._flag else 'clear',
if ((__pyx_v_self->_flag != 0)) { __Pyx_INCREF(__pyx_n_s_set); __pyx_t_1 = __pyx_n_s_set; } else { __Pyx_INCREF(__pyx_n_s_clear); __pyx_t_1 = __pyx_n_s_clear; }
+085: self.linkcount()
__pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_Event *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.linkcount(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
086: )
087:
+088: def is_set(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_5is_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_4is_set, "Event.is_set(self)\nReturn true if and only if the internal flag is true."); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_5is_set = {"is_set", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_5is_set, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_4is_set}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_5is_set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_set (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_4is_set(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_4is_set(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_set", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.Event.is_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 88, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_5is_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_is_set, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__6)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_is_set, __pyx_t_2) < 0) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_is_set, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 88, __pyx_L1_error)
089: """Return true if and only if the internal flag is true."""
+090: return self._flag
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
091:
+092: def isSet(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_7isSet(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_6isSet, "Event.isSet(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_7isSet = {"isSet", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_7isSet, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_6isSet}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_7isSet(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isSet (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_6isSet(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_6isSet(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isSet", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.Event.isSet", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 92, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_7isSet, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_isSet, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__8)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_isSet, __pyx_t_2) < 0) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_isSet, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 92, __pyx_L1_error)
093: # makes it a better drop-in replacement for threading.Event
+094: return self._flag
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_flag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
095:
+096: def ready(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_5Event_ready(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__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, 96, __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_14_gevent_cevent_5Event_9ready)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.Event.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_14_gevent_cevent_5Event_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_8ready, "Event.ready(self) -> bool"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_9ready = {"ready", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_9ready, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_8ready}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_9ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ready (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_8ready(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_8ready(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__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_14_gevent_cevent_5Event_ready(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.Event.ready", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 96, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_9ready, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_ready, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__10)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_ready, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_ready, 96, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 96, __pyx_L1_error)
097: # makes it compatible with AsyncResult and Greenlet (for
098: # example in wait())
+099: return self._flag
__pyx_r = __pyx_v_self->_flag; goto __pyx_L0;
100:
+101: def set(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_11set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_10set, "Event.set(self)\n\n Set the internal flag to true.\n\n All greenlets waiting for it to become true are awakened in\n some order at some time in the future. Greenlets that call\n :meth:`wait` once the flag is true will not block at all\n (until :meth:`clear` is called).\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_11set = {"set", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_11set, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_10set}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_11set(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_10set(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_10set(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.Event.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 101, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_11set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_set, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__12)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_set, __pyx_t_2) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_set, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 101, __pyx_L1_error)
102: """
103: Set the internal flag to true.
104:
105: All greenlets waiting for it to become true are awakened in
106: some order at some time in the future. Greenlets that call
107: :meth:`wait` once the flag is true will not block at all
108: (until :meth:`clear` is called).
109: """
+110: self._flag = True
__pyx_v_self->_flag = 1;
+111: self._check_and_notify()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_Event *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._check_and_notify(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
112:
+113: def clear(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_13clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_12clear, "Event.clear(self)\n\n Reset the internal flag to false.\n\n Subsequently, threads calling :meth:`wait` will block until\n :meth:`set` is called to set the internal flag to true again.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_13clear = {"clear", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_13clear, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_12clear}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_13clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_12clear(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_12clear(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 113, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_clear, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__14)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_clear, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 113, __pyx_L1_error)
114: """
115: Reset the internal flag to false.
116:
117: Subsequently, threads calling :meth:`wait` will block until
118: :meth:`set` is called to set the internal flag to true again.
119: """
+120: self._flag = False
__pyx_v_self->_flag = 0;
121:
+122: def _wait_return_value(self, waited, wait_success):
static PyObject *__pyx_f_6gevent_14_gevent_cevent_5Event__wait_return_value(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self, PyObject *__pyx_v_waited, PyObject *__pyx_v_wait_success) { int __pyx_v_flag; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_wait_return_value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._gevent_cevent.Event._wait_return_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
123: # To avoid the race condition outlined in http://bugs.python.org/issue13502,
124: # if we had to wait, then we need to return whether or not
125: # the condition got changed. Otherwise we simply echo
126: # the current state of the flag (which should be true)
+127: if not waited:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_waited); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 127, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { /* … */ }
+128: flag = self._flag
__pyx_t_2 = __pyx_v_self->_flag; __pyx_v_flag = __pyx_t_2;
+129: assert flag, "if we didn't wait we should already be set"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = (__pyx_v_flag != 0); if (unlikely(!__pyx_t_2)) { __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_s_if_we_didn_t_wait_we_should_alre, 0, 0); __PYX_ERR(0, 129, __pyx_L1_error) } } #else if ((1)); else __PYX_ERR(0, 129, __pyx_L1_error) #endif
+130: return flag
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_flag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
131:
+132: return wait_success
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_wait_success); __pyx_r = __pyx_v_wait_success; goto __pyx_L0;
133:
+134: def wait(self, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_15wait(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_14wait, "Event.wait(self, timeout=None)\n\n Block until this object is :meth:`ready`.\n\n If the internal flag is true on entry, return immediately. Otherwise,\n block until another thread (greenlet) calls :meth:`set` to set the flag to true,\n or until the optional *timeout* expires.\n\n When the *timeout* argument is present and not ``None``, it should be a\n floating point number specifying a timeout for the operation in seconds\n (or fractions thereof).\n\n :return: This method returns true if and only if the internal flag has been set to\n true, either before the wait call or after the wait starts, so it will\n always return ``True`` except if a timeout is given and the operation\n times out.\n\n .. versionchanged:: 1.1\n The return value represents the flag during the elapsed wait, not\n just after it elapses. This solves a race condition if one greenlet\n sets and then clears the flag without switching, while other greenlets\n are waiting. When the waiters wake up, this will return True; previously,\n they would still wake up, but the return value would be False. This is most\n noticeable when the *timeout* is present.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_15wait = {"wait", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_5Event_15wait, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_5Event_14wait}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_15wait(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_timeout = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wait (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #endif PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); if (value) { values[0] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wait") < 0)) __PYX_ERR(0, 134, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__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("wait", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 134, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.Event.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_14wait(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_14wait(struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wait", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.Event.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 134, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_15wait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event_wait, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__16)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_wait, __pyx_t_2) < 0) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_wait, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 134, __pyx_L1_error)
135: """
136: Block until this object is :meth:`ready`.
137:
138: If the internal flag is true on entry, return immediately. Otherwise,
139: block until another thread (greenlet) calls :meth:`set` to set the flag to true,
140: or until the optional *timeout* expires.
141:
142: When the *timeout* argument is present and not ``None``, it should be a
143: floating point number specifying a timeout for the operation in seconds
144: (or fractions thereof).
145:
146: :return: This method returns true if and only if the internal flag has been set to
147: true, either before the wait call or after the wait starts, so it will
148: always return ``True`` except if a timeout is given and the operation
149: times out.
150:
151: .. versionchanged:: 1.1
152: The return value represents the flag during the elapsed wait, not
153: just after it elapses. This solves a race condition if one greenlet
154: sets and then clears the flag without switching, while other greenlets
155: are waiting. When the waiters wake up, this will return True; previously,
156: they would still wake up, but the return value would be False. This is most
157: noticeable when the *timeout* is present.
158: """
+159: return self._wait(timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_Event *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._wait(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
160:
+161: def _reset_internal_locks(self): # pragma: no cover
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_17_reset_internal_locks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_5Event_16_reset_internal_locks, "Event._reset_internal_locks(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_5Event_17_reset_internal_locks = {"_reset_internal_locks", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_5Event_17_reset_internal_locks, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_5Event_16_reset_internal_locks}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_5Event_17_reset_internal_locks(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_reset_internal_locks (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_5Event_16_reset_internal_locks(((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_5Event_16_reset_internal_locks(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cevent_Event *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_reset_internal_locks", 0); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 161, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_5Event_17_reset_internal_locks, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Event__reset_internal_locks, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__18)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_Event->tp_dict, __pyx_n_s_reset_internal_locks, __pyx_t_2) < 0) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_Event); __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_reset_internal_locks, 161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 161, __pyx_L1_error)
162: # for compatibility with threading.Event
163: # Exception AttributeError: AttributeError("'Event' object has no attribute '_reset_internal_locks'",)
164: # in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
165: pass
166:
167:
+168: class AsyncResult(AbstractLinkable): # pylint:disable=undefined-variable
struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult { struct __pyx_vtabstruct_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable __pyx_base; PyObject *(*get)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cevent_11AsyncResult_get *__pyx_optional_args); int (*successful)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch); PyObject *(*wait)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cevent_11AsyncResult_wait *__pyx_optional_args); int (*done)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch); int (*cancel)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch); int (*cancelled)(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *__pyx_vtabptr_6gevent_14_gevent_cevent_AsyncResult;
169: """A one-time event that stores a value or an exception.
170:
171: Like :class:`Event` it wakes up all the waiters when :meth:`set` or :meth:`set_exception`
172: is called. Waiters may receive the passed value or exception by calling :meth:`get`
173: instead of :meth:`wait`. An :class:`AsyncResult` instance cannot be reset.
174:
175: To pass a value call :meth:`set`. Calls to :meth:`get` (those that are currently blocking as well as
176: those made in the future) will return the value:
177:
178: >>> result = AsyncResult()
179: >>> result.set(100)
180: >>> result.get()
181: 100
182:
183: To pass an exception call :meth:`set_exception`. This will cause :meth:`get` to raise that exception:
184:
185: >>> result = AsyncResult()
186: >>> result.set_exception(RuntimeError('failure'))
187: >>> result.get()
188: Traceback (most recent call last):
189: ...
190: RuntimeError: failure
191:
192: :class:`AsyncResult` implements :meth:`__call__` and thus can be used as :meth:`link` target:
193:
194: >>> import gevent
195: >>> result = AsyncResult()
196: >>> gevent.spawn(lambda : 1/0).link(result)
197: >>> try:
198: ... result.get()
199: ... except ZeroDivisionError:
200: ... print('ZeroDivisionError')
201: ZeroDivisionError
202:
203: .. note::
204: The order and timing in which waiting greenlets are awakened is not determined.
205: As an implementation note, in gevent 1.1 and 1.0, waiting greenlets are awakened in a
206: undetermined order sometime *after* the current greenlet yields to the event loop. Other greenlets
207: (those not waiting to be awakened) may run between the current greenlet yielding and
208: the waiting greenlets being awakened. These details may change in the future.
209:
210: .. versionchanged:: 1.1
211: The exact order in which waiting greenlets are awakened is not the same
212: as in 1.0.
213: .. versionchanged:: 1.1
214: Callbacks :meth:`linked <rawlink>` to this object are required to be hashable, and duplicates are
215: merged.
216: .. versionchanged:: 1.5a3
217: Waiting greenlets are now awakened in the order in which they waited.
218: .. versionchanged:: 1.5a3
219: The low-level ``rawlink`` method (most users won't use this) now automatically
220: unlinks waiters before calling them.
221: """
222:
+223: __slots__ = ('_value', '_exc_info', '_imap_task_index')
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_slots, __pyx_tuple__19) < 0) __PYX_ERR(0, 223, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); /* … */ __pyx_tuple__19 = PyTuple_Pack(3, __pyx_n_s_value_2, __pyx_n_s_exc_info_2, __pyx_n_s_imap_task_index); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19);
224:
+225: def __init__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;} if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult___init__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult___init__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { 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_AddTraceback("gevent._gevent_cevent.AsyncResult.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+226: super(AsyncResult, self).__init__()
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __Pyx_GIVEREF((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult)); __Pyx_INCREF((PyObject *)__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_3, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __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;
+227: self._value = _NONE
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_value); __Pyx_DECREF(__pyx_v_self->_value); __pyx_v_self->_value = __pyx_t_1; __pyx_t_1 = 0;
+228: self._exc_info = ()
__Pyx_INCREF(__pyx_empty_tuple); __Pyx_GIVEREF(__pyx_empty_tuple); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = __pyx_empty_tuple;
229:
+230: @property
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_10_exception_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_10_exception_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_10_exception___get__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_10_exception___get__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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._gevent_cevent.AsyncResult._exception.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
231: def _exception(self):
+232: return self._exc_info[1] if self._exc_info else _NONE
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_self->_exc_info != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 232, __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, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_NONE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
233:
+234: @property
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_5value_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_5value___get__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_5value___get__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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_2); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
235: def value(self):
236: """
237: Holds the value passed to :meth:`set` if :meth:`set` was called. Otherwise,
238: ``None``
239: """
+240: return self._value if self._value is not _NONE else None
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_v_self->_value != __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((__pyx_t_3 != 0)) { __Pyx_INCREF(__pyx_v_self->_value); __pyx_t_1 = __pyx_v_self->_value; } else { __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
241:
+242: @property
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_8exc_info_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_8exc_info_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_8exc_info___get__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_8exc_info___get__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.exc_info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
243: def exc_info(self):
244: """
245: The three-tuple of exception information if :meth:`set_exception` was called.
246: """
+247: if self._exc_info:
__pyx_t_1 = (__pyx_v_self->_exc_info != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) != 0);
if (__pyx_t_1) {
/* … */
}
+248: return (self._exc_info[0], self._exc_info[1], load_traceback(self._exc_info[2]))
__Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 248, __pyx_L1_error) } __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_exc_info, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 248, __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, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 248, __pyx_L1_error) } __pyx_t_5 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_exc_info, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cevent_load_traceback); __pyx_t_6 = __pyx_v_6gevent_14_gevent_cevent_load_traceback; __pyx_t_7 = NULL; __pyx_t_8 = 0; 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_8 = 1; } } { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __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, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0;
+249: return ()
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_empty_tuple); __pyx_r = __pyx_empty_tuple; goto __pyx_L0;
250:
+251: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_3__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_3__str__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_2__str__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_2__str__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.__str__", __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; }
+252: result = '<%s ' % (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, 252, __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, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __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, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_result = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+253: if self.value is not None or self._exception is not _NONE:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__pyx_t_2 != Py_None); __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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = (__pyx_t_2 != __pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = (__pyx_t_5 != 0); __pyx_t_3 = __pyx_t_4; __pyx_L4_bool_binop_done:; if (__pyx_t_3) { /* … */ }
+254: result += 'value=%r ' % self.value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_value_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+255: if self._exception is not None and self._exception is not _NONE:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __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_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { } else { __pyx_t_3 = __pyx_t_5; goto __pyx_L7_bool_binop_done; } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exception); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = (__pyx_t_1 != __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_t_5 != 0); __pyx_t_3 = __pyx_t_4; __pyx_L7_bool_binop_done:; if (__pyx_t_3) { /* … */ }
+256: result += 'exception=%r ' % self._exception
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_exception_r, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __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, 256, __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;
+257: if self._exception is _NONE:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__pyx_t_2 == __pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* … */ }
+258: result += 'unset '
__pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_kp_s_unset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0;
+259: return result + ' _links[%s]>' % self.linkcount()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.linkcount(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_links_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __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;
260:
+261: def ready(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_11AsyncResult_ready(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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, 261, __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_14_gevent_cevent_11AsyncResult_5ready)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.AsyncResult.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_14_gevent_cevent_11AsyncResult_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_4ready, "AsyncResult.ready(self) -> bool\nReturn true if and only if it holds a value or an exception"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_5ready = {"ready", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_5ready, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_4ready}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_5ready(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ready (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_4ready(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_4ready(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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_14_gevent_cevent_11AsyncResult_ready(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.ready", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 261, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_5ready, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_ready, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__21)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_ready, __pyx_t_2) < 0) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_ready, 261, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 261, __pyx_L1_error)
262: """Return true if and only if it holds a value or an exception"""
+263: return self._exc_info or self._value is not _NONE
__pyx_t_7 = (__pyx_v_self->_exc_info != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) != 0); if (!__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = (__pyx_v_self->_value != __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = (__pyx_t_7 != 0); __pyx_t_6 = __pyx_t_8; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_6; goto __pyx_L0;
264:
+265: def successful(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_7successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_11AsyncResult_successful(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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, 265, __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_14_gevent_cevent_11AsyncResult_7successful)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.AsyncResult.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_14_gevent_cevent_11AsyncResult_7successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_6successful, "AsyncResult.successful(self) -> bool\nReturn true if and only if it is ready and holds a value"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_7successful = {"successful", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_7successful, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_6successful}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_7successful(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("successful (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_6successful(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_6successful(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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_14_gevent_cevent_11AsyncResult_successful(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.successful", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 265, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 265, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_7successful, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_successful, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__23)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_successful, __pyx_t_2) < 0) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_successful, 265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 265, __pyx_L1_error)
266: """Return true if and only if it is ready and holds a value"""
+267: return self._value is not _NONE
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = (__pyx_v_self->_value != __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_6; goto __pyx_L0;
268:
+269: @property
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_9exception_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_9exception_1__get__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_9exception___get__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_9exception___get__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { 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_AddTraceback("gevent._gevent_cevent.AsyncResult.exception.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
270: def exception(self):
271: """Holds the exception instance passed to :meth:`set_exception` if :meth:`set_exception` was called.
272: Otherwise ``None``."""
+273: if self._exc_info:
__pyx_t_1 = (__pyx_v_self->_exc_info != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) != 0);
if (__pyx_t_1) {
/* … */
}
+274: return self._exc_info[1]
__Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_self->_exc_info == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 274, __pyx_L1_error) } __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_self->_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
275:
+276: def set(self, value=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_9set(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_8set, "AsyncResult.set(self, value=None)\nStore the value and wake up any waiters.\n\n All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.\n Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_9set = {"set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_9set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_8set}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_9set(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_value = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; #endif PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value); if (value) { values[0] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set") < 0)) __PYX_ERR(0, 276, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_value = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 276, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_8set(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_value); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_8set(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, PyObject *__pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 276, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_9set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_set, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__25)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_set, __pyx_t_2) < 0) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_set, 276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 276, __pyx_L1_error)
277: """Store the value and wake up any waiters.
278:
279: All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.
280: Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.
281: """
+282: self._value = value
__Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->_value); __Pyx_DECREF(__pyx_v_self->_value); __pyx_v_self->_value = __pyx_v_value;
+283: self._check_and_notify()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._check_and_notify(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
284:
+285: def set_exception(self, exception, exc_info=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_11set_exception(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_10set_exception, "AsyncResult.set_exception(self, exception, exc_info=None)\nStore the exception and wake up any waiters.\n\n All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.\n Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.\n\n :keyword tuple exc_info: If given, a standard three-tuple of type, value, :class:`traceback`\n as returned by :func:`sys.exc_info`. This will be used when the exception\n is re-raised to propagate the correct traceback.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_11set_exception = {"set_exception", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_11set_exception, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_10set_exception}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_11set_exception(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_exception = 0; PyObject *__pyx_v_exc_info = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_exception (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exception_2,&__pyx_n_s_exc_info,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exception_2,&__pyx_n_s_exc_info,0}; #endif PyObject* values[2] = {0,0}; values[1] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exception_2)) != 0)) kw_args--; else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_info); if (value) { values[1] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_exception") < 0)) __PYX_ERR(0, 285, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_exception = values[0]; __pyx_v_exc_info = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set_exception", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 285, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.set_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_10set_exception(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_exception, __pyx_v_exc_info); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_10set_exception(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, PyObject *__pyx_v_exception, PyObject *__pyx_v_exc_info) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_exception", 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.set_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__26 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_exception_2, __pyx_n_s_exc_info); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 285, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_11set_exception, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_set_exception, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__27)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_set_exception, __pyx_t_2) < 0) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_set_exception, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 285, __pyx_L1_error)
286: """Store the exception and wake up any waiters.
287:
288: All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.
289: Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.
290:
291: :keyword tuple exc_info: If given, a standard three-tuple of type, value, :class:`traceback`
292: as returned by :func:`sys.exc_info`. This will be used when the exception
293: is re-raised to propagate the correct traceback.
294: """
+295: if exc_info:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc_info); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 295, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+296: self._exc_info = (exc_info[0], exc_info[1], dump_traceback(exc_info[2]))
__pyx_t_2 = __Pyx_GetItemInt(__pyx_v_exc_info, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_exc_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_exc_info, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cevent_dump_traceback); __pyx_t_6 = __pyx_v_6gevent_14_gevent_cevent_dump_traceback; __pyx_t_7 = NULL; __pyx_t_8 = 0; 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_8 = 1; } } { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_5}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __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, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
297: else:
+298: self._exc_info = (type(exception), exception, dump_traceback(None))
/*else*/ { __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cevent_dump_traceback); __pyx_t_4 = __pyx_v_6gevent_14_gevent_cevent_dump_traceback; __pyx_t_3 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_8 = 1; } } { PyObject *__pyx_callargs[2] = {__pyx_t_3, Py_None}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __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, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_exception))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_exception))); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_v_exception))); __Pyx_INCREF(__pyx_v_exception); __Pyx_GIVEREF(__pyx_v_exception); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_exception); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6); __pyx_t_6 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_exc_info); __Pyx_DECREF(__pyx_v_self->_exc_info); __pyx_v_self->_exc_info = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; } __pyx_L3:;
299:
+300: self._check_and_notify()
__pyx_t_4 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._check_and_notify(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
301:
+302: def _raise_exception(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_13_raise_exception(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_12_raise_exception, "AsyncResult._raise_exception(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_13_raise_exception = {"_raise_exception", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_13_raise_exception, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_12_raise_exception}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_13_raise_exception(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_raise_exception (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_12_raise_exception(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_12_raise_exception(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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._gevent_cevent.AsyncResult._raise_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 302, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_13_raise_exception, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult__raise_exception, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__29)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_raise_exception, __pyx_t_2) < 0) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_raise_exception, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 302, __pyx_L1_error)
+303: 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, 303, __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, 303, __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_14_gevent_cevent_reraise, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __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;
304:
+305: def get(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_15get(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyObject *__pyx_f_6gevent_14_gevent_cevent_11AsyncResult_get(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cevent_11AsyncResult_get *__pyx_optional_args) { PyObject *__pyx_v_block = ((PyObject *)Py_True); PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_block = __pyx_optional_args->block; if (__pyx_optional_args->__pyx_n > 1) { __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_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __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_14_gevent_cevent_11AsyncResult_15get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __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_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.get", __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_14_gevent_cevent_11AsyncResult_15get(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_14get, "AsyncResult.get(self, block=True, timeout=None)\nReturn the stored value or raise the exception.\n\n If this instance already holds a value or an exception, return or raise it immediately.\n Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception` or\n until the optional timeout occurs.\n\n When the *timeout* argument is present and not ``None``, it should be a\n floating point number specifying a timeout for the operation in seconds\n (or fractions thereof). If the *timeout* elapses, the *Timeout* exception will\n be raised.\n\n :keyword bool block: If set to ``False`` and this instance is not ready,\n immediately raise a :class:`Timeout` exception.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_15get = {"get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_15get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_14get}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_15get(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; #endif PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_True); values[1] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_block); if (value) { values[0] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get") < 0)) __PYX_ERR(0, 305, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__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, __pyx_nargs); __PYX_ERR(0, 305, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_14get(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_14get(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cevent_AsyncResult->get(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__30 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 305, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_15get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_get, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__31)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_get, __pyx_t_2) < 0) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_get, 305, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 305, __pyx_L1_error)
306: """Return the stored value or raise the exception.
307:
308: If this instance already holds a value or an exception, return or raise it immediately.
309: Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception` or
310: until the optional timeout occurs.
311:
312: When the *timeout* argument is present and not ``None``, it should be a
313: floating point number specifying a timeout for the operation in seconds
314: (or fractions thereof). If the *timeout* elapses, the *Timeout* exception will
315: be raised.
316:
317: :keyword bool block: If set to ``False`` and this instance is not ready,
318: immediately raise a :class:`Timeout` exception.
319: """
+320: if self._value is not _NONE:
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = (__pyx_v_self->_value != __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { /* … */ }
+321: return self._value
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_value); __pyx_r = __pyx_v_self->_value; goto __pyx_L0;
+322: if self._exc_info:
__pyx_t_7 = (__pyx_v_self->_exc_info != Py_None)&&(PyTuple_GET_SIZE(__pyx_v_self->_exc_info) != 0);
if (__pyx_t_7) {
/* … */
}
+323: return self._raise_exception()
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_raise_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __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; } } { PyObject *__pyx_callargs[1] = {__pyx_t_3, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
324:
+325: if not block:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 325, __pyx_L1_error) __pyx_t_6 = ((!__pyx_t_7) != 0); if (unlikely(__pyx_t_6)) { /* … */ }
326: # Not ready and not blocking, so immediately timeout
+327: raise Timeout()
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_cevent_Timeout); __pyx_t_2 = __pyx_v_6gevent_14_gevent_cevent_Timeout; __pyx_t_3 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_3, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __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, 327, __pyx_L1_error)
328:
+329: self._capture_hub(True)
((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._capture_hub(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), 1);
330:
331: # Wait, raising a timeout that elapses
+332: self._wait_core(timeout, ())
__pyx_t_8.__pyx_n = 1; __pyx_t_8.catch = __pyx_empty_tuple; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._wait_core(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), __pyx_v_timeout, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
333:
334: # by definition we are now ready
+335: return self.get(block=False)
__Pyx_XDECREF(__pyx_r); __pyx_t_9.__pyx_n = 1; __pyx_t_9.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
336:
+337: def get_nowait(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_17get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_16get_nowait, "AsyncResult.get_nowait(self)\n\n Return the value or raise the exception without blocking.\n\n If this object is not yet :meth:`ready <ready>`, raise\n :class:`gevent.Timeout` immediately.\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_17get_nowait = {"get_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_17get_nowait, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_16get_nowait}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_17get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_16get_nowait(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_16get_nowait(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.get_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 337, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_17get_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_get_nowait, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__33)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_get_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_get_nowait, 337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 337, __pyx_L1_error)
338: """
339: Return the value or raise the exception without blocking.
340:
341: If this object is not yet :meth:`ready <ready>`, raise
342: :class:`gevent.Timeout` immediately.
343: """
+344: return self.get(block=False)
__Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
345:
+346: def _wait_return_value(self, waited, wait_success):
static PyObject *__pyx_f_6gevent_14_gevent_cevent_11AsyncResult__wait_return_value(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_waited, CYTHON_UNUSED PyObject *__pyx_v_wait_success) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_wait_return_value", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult._wait_return_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
347: # pylint:disable=unused-argument
348: # Always return the value. Since this is a one-shot event,
349: # no race condition should reset it.
+350: return self.value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
351:
+352: def wait(self, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_19wait(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ static PyObject *__pyx_f_6gevent_14_gevent_cevent_11AsyncResult_wait(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cevent_11AsyncResult_wait *__pyx_optional_args) { PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wait", 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_wait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __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_14_gevent_cevent_11AsyncResult_19wait)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __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_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.wait", __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_14_gevent_cevent_11AsyncResult_19wait(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_18wait, "AsyncResult.wait(self, timeout=None)\nBlock until the instance is ready.\n\n If this instance already holds a value, it is returned immediately. If this\n instance already holds an exception, ``None`` is returned immediately.\n\n Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception`\n (at which point either the value or ``None`` will be returned, respectively),\n or until the optional timeout expires (at which point ``None`` will also be\n returned).\n\n When the *timeout* argument is present and not ``None``, it should be a\n floating point number specifying a timeout for the operation in seconds\n (or fractions thereof).\n\n .. note:: If a timeout is given and expires, ``None`` will be returned\n (no timeout exception will be raised).\n\n "); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_19wait = {"wait", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_19wait, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_18wait}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_19wait(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_timeout = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wait (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #endif PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); if (value) { values[0] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wait") < 0)) __PYX_ERR(0, 352, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__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("wait", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 352, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_18wait(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_18wait(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("wait", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cevent_AsyncResult->wait(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.wait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__34 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 352, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_19wait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_wait, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__35)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_wait, __pyx_t_2) < 0) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_wait, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 352, __pyx_L1_error)
353: """Block until the instance is ready.
354:
355: If this instance already holds a value, it is returned immediately. If this
356: instance already holds an exception, ``None`` is returned immediately.
357:
358: Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception`
359: (at which point either the value or ``None`` will be returned, respectively),
360: or until the optional timeout expires (at which point ``None`` will also be
361: returned).
362:
363: When the *timeout* argument is present and not ``None``, it should be a
364: floating point number specifying a timeout for the operation in seconds
365: (or fractions thereof).
366:
367: .. note:: If a timeout is given and expires, ``None`` will be returned
368: (no timeout exception will be raised).
369:
370: """
+371: return self._wait(timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_6.__pyx_n = 1; __pyx_t_6.timeout = __pyx_v_timeout; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._wait(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
372:
373: # link protocol
+374: def __call__(self, source):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_21__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_21__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_source = 0; CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,0}; #endif PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_source)) != 0)) kw_args--; else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(0, 374, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } __pyx_v_source = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 374, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_20__call__(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_source); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_20__call__(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__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_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+375: if source.successful():
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_successful); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_3, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+376: self.set(source.value)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __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;
377: else:
+378: self.set_exception(source.exception, getattr(source, 'exc_info', None))
/*else*/ { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_exception_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_GetAttr3(__pyx_v_source, __pyx_n_s_exc_info, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } { PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_3, __pyx_t_6}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __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; } __pyx_L3:;
379:
380: # Methods to make us more like concurrent.futures.Future
381:
+382: def result(self, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_23result(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_22result, "AsyncResult.result(self, timeout=None)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_23result = {"result", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_23result, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_22result}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_23result(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_timeout = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("result (wrapper)", 0); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #else static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; #endif PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_timeout); if (value) { values[0] = value; kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "result") < 0)) __PYX_ERR(0, 382, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__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("result", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 382, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.result", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_22result(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_22result(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("result", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.result", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__36 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 382, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_23result, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_result, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__37)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_result, __pyx_t_2) < 0) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_result, 382, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 382, __pyx_L1_error)
+383: return self.get(timeout=timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(0, 383, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
384:
+385: set_result = set
__Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult, __pyx_n_s_set); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_set_result, __pyx_t_2) < 0) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult);
386:
+387: def done(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_25done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_11AsyncResult_done(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("done", 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_done); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __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_14_gevent_cevent_11AsyncResult_25done)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.AsyncResult.done", __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_14_gevent_cevent_11AsyncResult_25done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_24done, "AsyncResult.done(self) -> bool"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_25done = {"done", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_25done, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_24done}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_25done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("done (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_24done(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_24done(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("done", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_14_gevent_cevent_11AsyncResult_done(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.done", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 387, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_25done, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_done, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__39)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_done, __pyx_t_2) < 0) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_done, 387, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 387, __pyx_L1_error)
+388: return self.ready()
__pyx_r = ((struct __pyx_vtabstruct_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.ready(((struct __pyx_obj_6gevent_27_gevent_c_abstract_linkable_AbstractLinkable *)__pyx_v_self), 0); goto __pyx_L0;
389:
390: # we don't support cancelling
391:
+392: def cancel(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_27cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_11AsyncResult_cancel(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancel", 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_cancel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __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_14_gevent_cevent_11AsyncResult_27cancel)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.AsyncResult.cancel", __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_14_gevent_cevent_11AsyncResult_27cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_26cancel, "AsyncResult.cancel(self) -> bool"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_27cancel = {"cancel", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_27cancel, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_26cancel}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_27cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancel (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_26cancel(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_26cancel(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancel", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_14_gevent_cevent_11AsyncResult_cancel(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.cancel", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__40); __Pyx_GIVEREF(__pyx_tuple__40); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 392, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_27cancel, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_cancel, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__41)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_cancel, __pyx_t_2) < 0) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult); __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_event_py, __pyx_n_s_cancel, 392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 392, __pyx_L1_error)
+393: return False
__pyx_r = 0; goto __pyx_L0;
394:
+395: def cancelled(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_29cancelled(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_14_gevent_cevent_11AsyncResult_cancelled(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancelled", 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_cancelled); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __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_14_gevent_cevent_11AsyncResult_29cancelled)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } { PyObject *__pyx_callargs[1] = {__pyx_t_4, }; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __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._gevent_cevent.AsyncResult.cancelled", __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_14_gevent_cevent_11AsyncResult_29cancelled(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_28cancelled, "AsyncResult.cancelled(self) -> bool"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_29cancelled = {"cancelled", (PyCFunction)__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_29cancelled, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cevent_11AsyncResult_28cancelled}; static PyObject *__pyx_pw_6gevent_14_gevent_cevent_11AsyncResult_29cancelled(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancelled (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_28cancelled(((struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cevent_11AsyncResult_28cancelled(struct __pyx_obj_6gevent_14_gevent_cevent_AsyncResult *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cancelled", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_14_gevent_cevent_11AsyncResult_cancelled(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._gevent_cevent.AsyncResult.cancelled", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42); /* … */ #if CYTHON_COMPILING_IN_LIMITED_API __pyx_t_3 = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 395, __pyx_L1_error) #else __pyx_t_3 = __pyx_d; if ((1)); else __PYX_ERR(0, 395, __pyx_L1_error); #endif __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cevent_11AsyncResult_29cancelled, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_AsyncResult_cancelled, NULL, __pyx_n_s_gevent__gevent_cevent, __pyx_t_3, ((PyObject *)__pyx_codeobj__43)); __pyx_t_3 = NULL; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult->tp_dict, __pyx_n_s_cancelled, __pyx_t_2) < 0) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6gevent_14_gevent_cevent_AsyncResult);
+396: return False
__pyx_r = 0; goto __pyx_L0;
397:
398: # exception is a method, we use it as a property
399:
400:
+401: from gevent._util import import_c_accel
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_import_c_accel); __Pyx_GIVEREF(__pyx_n_s_import_c_accel); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_import_c_accel); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __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_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 401, __pyx_L1_error) #endif if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 401, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+402: import_c_accel(globals(), 'gevent._event')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_INCREF(__pyx_kp_s_gevent__event); __Pyx_GIVEREF(__pyx_kp_s_gevent__event); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_s_gevent__event); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;