Generated by Cython 3.1.2
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: queue.c
+001: # Copyright (c) 2009-2012 Denis Bilenko. See LICENSE for details.
__pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_6) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
002: # copyright (c) 2018 gevent
003: # cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
004: """
005: Synchronized queues.
006:
007: The :mod:`gevent.queue` module implements multi-producer, multi-consumer queues
008: that work across greenlets, with the API similar to the classes found in the
009: standard :mod:`Queue` and :class:`multiprocessing <multiprocessing.Queue>` modules.
010:
011: The classes in this module implement the iterator protocol. Iterating
012: over a queue means repeatedly calling :meth:`get <Queue.get>` until
013: :meth:`get <Queue.get>` returns ``StopIteration`` (specifically that
014: class, not an instance or subclass).
015:
016: >>> import gevent.queue
017: >>> queue = gevent.queue.Queue()
018: >>> queue.put(1)
019: >>> queue.put(2)
020: >>> queue.put(StopIteration)
021: >>> for item in queue:
022: ... print(item)
023: 1
024: 2
025:
026: .. versionchanged:: 1.0
027: ``Queue(0)`` now means queue of infinite size, not a channel. A :exc:`DeprecationWarning`
028: will be issued with this argument.
029:
030: .. versionchanged:: 25.4.1
031: :class:`Queue` was renamed to :class:`SimpleQueue`, while :class:`JoinableQueue` was
032: renamed to :class:`Queue` (`JoinableQueue` remains a backwards compatible alias).
033: This adds the ability to ``join()`` all queues, like the standard library.
034:
035: Previously ``SimpleQueue`` was an alias for the undocumented Python
036: implementation ``queue._PySimpleQueue``; now it is gevent's own implementation.
037: This ensures that it is cooperative even without monkey-patching.
038: """
039:
040:
+041: import sys
__pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+042: from heapq import heappush as _heappush
__pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_heappush_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_heapq, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_heappush_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue__heappush); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue__heappush, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+043: from heapq import heappop as _heappop
__pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_heappop_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_heapq, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_heappop_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue__heappop); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue__heappop, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+044: from heapq import heapify as _heapify
__pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_heapify_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_heapq, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_heapify_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue__heapify); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue__heapify, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+045: import collections
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_collections, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_collections, __pyx_t_3) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+046: import types
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_types, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_types, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
047:
+048: import queue as __queue__
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_queue, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_queue_3, __pyx_t_3) < 0) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
049: # We re-export these exceptions to client modules.
050: # But we also want fast access to them from Cython with a cdef,
051: # and we do that with the _ definition.
+052: _Full = Full = __queue__.Full
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_queue_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue__Full); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue__Full, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Full, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+053: _Empty = Empty = __queue__.Empty
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_queue_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue__Empty); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue__Empty, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Empty, __pyx_t_3) < 0) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
054:
+055: from gevent.timeout import Timeout
__pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_timeout, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue_Timeout); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue_Timeout, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+056: from gevent._hub_local import get_hub_noargs as get_hub
__pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_get_hub_noargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__hub_local, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_hub_noargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_hub_noargs, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+057: from gevent.exceptions import InvalidSwitchError
__pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_InvalidSwitchError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_exceptions, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_InvalidSwitchError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError); __Pyx_DECREF_SET(__pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
058:
+059: __all__ = []
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_2) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+060: __implements__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'SimpleQueue']
__pyx_t_2 = __Pyx_PyList_Pack(4, __pyx_mstate_global->__pyx_n_u_Queue, __pyx_mstate_global->__pyx_n_u_PriorityQueue, __pyx_mstate_global->__pyx_n_u_LifoQueue, __pyx_mstate_global->__pyx_n_u_SimpleQueue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_implements, __pyx_t_2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+061: __extensions__ = ['JoinableQueue', 'Channel']
__pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_JoinableQueue, __pyx_mstate_global->__pyx_n_u_Channel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_extensions, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+062: __imports__ = ['Empty', 'Full']
__pyx_t_2 = __Pyx_PyList_Pack(2, __pyx_mstate_global->__pyx_n_u_Empty, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_imports, __pyx_t_2) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
063:
+064: if hasattr(__queue__, 'ShutDown'): # New in 3.13
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_queue_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L2; }
+065: ShutDown = __queue__.ShutDown
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_queue_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ShutDown, __pyx_t_3) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+066: __imports__.append('ShutDown')
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_imports); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
067: else:
+068: class ShutDown(Exception):
/*else*/ {
__pyx_t_3 = PyTuple_Pack(1, ((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_mstate_global->__pyx_n_u_ShutDown, __pyx_mstate_global->__pyx_n_u_ShutDown, (PyObject *) NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_kp_u_gevent_extension_for_Python_ver); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
if (__pyx_t_2 != __pyx_t_3) {
if (unlikely((PyDict_SetItemString(__pyx_t_7, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ShutDown, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ShutDown, __pyx_t_3) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
069: """
070: gevent extension for Python versions less than 3.13
071: """
+072: __extensions__.append('ShutDown')
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_extensions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L2:;
073:
074:
+075: __all__ += (__implements__ + __extensions__ + __imports__)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_implements); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_extensions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_imports); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_7) < 0) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
076:
077:
078: # pylint 2.0.dev2 things collections.dequeue.popleft() doesn't return
079: # pylint:disable=assignment-from-no-return
080:
+081: def _safe_remove(deq, item):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue__safe_remove(PyObject *__pyx_v_deq, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("gevent._gevent_cqueue._safe_remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
082: # For when the item may have been removed by
083: # Queue._unlock
+084: try:
{
/*try:*/ {
/* … */
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L8_try_end;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* … */
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
__pyx_L8_try_end:;
}
+085: deq.remove(item)
__pyx_t_5 = __pyx_v_deq;
__Pyx_INCREF(__pyx_t_5);
__pyx_t_6 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_item};
__pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_remove, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L3_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+086: except ValueError:
__pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError); if (__pyx_t_7) { __Pyx_ErrRestore(0,0,0); goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error;
087: pass
088:
+089: import gevent._waiter
__pyx_t_7 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__waiter, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gevent, __pyx_t_7) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_gevent, __pyx_mstate_global->__pyx_n_u_waiter); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
+090: locals()['Waiter'] = gevent._waiter.Waiter
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_gevent); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Waiter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_Globals(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (unlikely((PyDict_SetItem(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Waiter, __pyx_t_7) < 0))) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+091: locals()['getcurrent'] = __import__('greenlet').getcurrent
__pyx_t_6 = NULL; __Pyx_INCREF(__pyx_builtin___import__); __pyx_t_2 = __pyx_builtin___import__; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_n_u_greenlet}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_Globals(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (unlikely((PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_getcurrent, __pyx_t_2) < 0))) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+092: locals()['greenlet_init'] = lambda: None
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_2lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_2lambda = {"lambda", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_2lambda, METH_NOARGS, 0};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_2lambda(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("lambda (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_lambda_funcdef_6gevent_14_gevent_cqueue_lambda(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_lambda_funcdef_6gevent_14_gevent_cqueue_lambda(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_2lambda, 0, __pyx_mstate_global->__pyx_n_u_lambda, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_7 = __Pyx_Globals(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 92, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
if (unlikely((PyDict_SetItem(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_greenlet_init, __pyx_t_2) < 0))) __PYX_ERR(0, 92, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
093:
+094: class ItemWaiter(Waiter): # pylint:disable=undefined-variable
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_ItemWaiter {
struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_Waiter __pyx_base;
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_ItemWaiter *__pyx_vtabptr_6gevent_14_gevent_cqueue_ItemWaiter;
095: # pylint:disable=assigning-non-slot
096: __slots__ = (
+097: 'item',
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_ItemWaiter, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[2]) < 0) __PYX_ERR(0, 96, __pyx_L1_error) /* … */ __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_item, __pyx_mstate_global->__pyx_n_u_queue); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
098: 'queue',
099: )
100:
+101: def __init__(self, item, queue):
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_10ItemWaiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_10ItemWaiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_item = 0;
PyObject *__pyx_v_queue = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,&__pyx_mstate_global->__pyx_n_u_queue,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 101, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 101, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 101, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 101, __pyx_L3_error)
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 101, __pyx_L3_error)
}
__pyx_v_item = values[0];
__pyx_v_queue = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.ItemWaiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_10ItemWaiter___init__(((struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *)__pyx_v_self), __pyx_v_item, __pyx_v_queue);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_10ItemWaiter___init__(struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_queue) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("gevent._gevent_cqueue.ItemWaiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+102: Waiter.__init__(self) # pylint:disable=undefined-variable
__pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+103: self.item = item
__Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); __Pyx_GOTREF(__pyx_v_self->item); __Pyx_DECREF(__pyx_v_self->item); __pyx_v_self->item = __pyx_v_item;
+104: self.queue = queue
__pyx_t_1 = __pyx_v_queue; __Pyx_INCREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue))))) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->queue); __Pyx_DECREF((PyObject *)__pyx_v_self->queue); __pyx_v_self->queue = ((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_t_1); __pyx_t_1 = 0;
105:
+106: def put_and_switch(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_10ItemWaiter_3put_and_switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_10ItemWaiter_2put_and_switch, "ItemWaiter.put_and_switch(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_10ItemWaiter_3put_and_switch = {"put_and_switch", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_10ItemWaiter_3put_and_switch, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_10ItemWaiter_2put_and_switch}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_10ItemWaiter_3put_and_switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_and_switch (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_10ItemWaiter_2put_and_switch(((struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_10ItemWaiter_2put_and_switch(struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._gevent_cqueue.ItemWaiter.put_and_switch", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_10ItemWaiter_3put_and_switch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ItemWaiter_put_and_switch, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_ItemWaiter, __pyx_mstate_global->__pyx_n_u_put_and_switch, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+107: self.queue._put(self.item)
__pyx_t_1 = __pyx_v_self->item; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self->queue->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->queue), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+108: self.queue = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF((PyObject *)__pyx_v_self->queue); __Pyx_DECREF((PyObject *)__pyx_v_self->queue); __pyx_v_self->queue = ((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)Py_None);
+109: self.item = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->item); __Pyx_DECREF(__pyx_v_self->item); __pyx_v_self->item = Py_None;
+110: return self.switch(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_self)}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
111:
112:
+113: class SimpleQueue(object):
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue {
PyObject *(*_get)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
PyObject *(*_put)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, PyObject *, int __pyx_skip_dispatch);
Py_ssize_t (*_qsize)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
PyObject *(*_peek)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
Py_ssize_t (*qsize)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
int (*empty)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
int (*full)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
PyObject *(*_create_queue)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue__create_queue *__pyx_optional_args);
PyObject *(*put)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_put *__pyx_optional_args);
PyObject *(*put_nowait)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, PyObject *, int __pyx_skip_dispatch);
PyObject *(*_SimpleQueue__get_or_peek)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, PyObject *, PyObject *, PyObject *);
PyObject *(*get)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_get *__pyx_optional_args);
PyObject *(*get_nowait)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
PyObject *(*peek)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_peek *__pyx_optional_args);
PyObject *(*peek_nowait)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *, int __pyx_skip_dispatch);
PyObject *(*_schedule_unlock)(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *);
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_vtabptr_6gevent_14_gevent_cqueue_SimpleQueue;
114: """
115: Create a queue object with a given maximum size.
116:
117: If *maxsize* is less than or equal to zero or ``None``, the queue
118: size is infinite.
119:
120: Queues have a ``len`` equal to the number of items in them (the :meth:`qsize`),
121: but in a boolean context they are always True.
122:
123: .. versionchanged:: 1.1b3
124: Queues now support :func:`len`; it behaves the same as :meth:`qsize`.
125: .. versionchanged:: 1.1b3
126: Multiple greenlets that block on a call to :meth:`put` for a full queue
127: will now be awakened to put their items into the queue in the order in which
128: they arrived. Likewise, multiple greenlets that block on a call to :meth:`get` for
129: an empty queue will now receive items in the order in which they blocked. An
130: implementation quirk under CPython *usually* ensured this was roughly the case
131: previously anyway, but that wasn't the case for PyPy.
132: .. versionchanged:: 24.10.1
133: Implement the ``shutdown`` methods from Python 3.13.
134: .. versionchanged:: 25.4.1
135: Renamed from ``Queue`` to ``SimpleQueue`` to better match the standard library.
136: While this class no longer has a ``shutdown`` method, the new ``Queue`` class
137: (previously ``JoinableQueue``) continues to have it.
138: .. versionchanged:: 25.4.2
139: Make this class subscriptable.
140: """
141:
142: __slots__ = (
+143: '_maxsize',
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[3]) < 0) __PYX_ERR(0, 142, __pyx_L1_error) /* … */ __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(8, __pyx_mstate_global->__pyx_n_u_maxsize_3, __pyx_mstate_global->__pyx_n_u_getters, __pyx_mstate_global->__pyx_n_u_putters, __pyx_mstate_global->__pyx_n_u_hub, __pyx_mstate_global->__pyx_n_u_event_unlock, __pyx_mstate_global->__pyx_n_u_queue, __pyx_mstate_global->__pyx_n_u_weakref, __pyx_mstate_global->__pyx_n_u_is_shutdown); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
144: 'getters',
145: 'putters',
146: 'hub',
147: '_event_unlock',
148: 'queue',
149: '__weakref__',
150: 'is_shutdown', # 3.13
151: )
152:
+153: __class_getitem__ = classmethod(types.GenericAlias)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_GenericAlias); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_class_getitem, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
154:
+155: def __init__(self, maxsize=None, items=(), _warn_depth=2):
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_maxsize = 0;
PyObject *__pyx_v_items = 0;
PyObject *__pyx_v__warn_depth = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_maxsize,&__pyx_mstate_global->__pyx_n_u_items,&__pyx_mstate_global->__pyx_n_u_warn_depth,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 155, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 155, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_2));
} else {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 155, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_2));
}
__pyx_v_maxsize = values[0];
__pyx_v_items = values[1];
__pyx_v__warn_depth = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 155, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue___init__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items, __pyx_v__warn_depth);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue___init__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items, PyObject *__pyx_v__warn_depth) {
PyObject *__pyx_v_warnings = NULL;
int __pyx_r;
__Pyx_INCREF(__pyx_v_maxsize);
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_warnings);
__Pyx_XDECREF(__pyx_v_maxsize);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+156: if maxsize is not None and maxsize <= 0:
__pyx_t_2 = (__pyx_v_maxsize != Py_None);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_3 = PyObject_RichCompare(__pyx_v_maxsize, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 156, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+157: if maxsize == 0:
__pyx_t_1 = (__Pyx_PyLong_BoolEqObjC(__pyx_v_maxsize, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 157, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+158: import warnings
__pyx_t_3 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_warnings, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_warnings = __pyx_t_3; __pyx_t_3 = 0;
+159: warnings.warn(
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0], __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* … */ __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_kp_u_Queue_0_now_equivalent_to_Queue, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);
160: 'Queue(0) now equivalent to Queue(None); if you want a channel, use Channel',
161: DeprecationWarning,
+162: stacklevel=_warn_depth)
__pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_stacklevel, __pyx_v__warn_depth) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
+163: maxsize = None
__Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_maxsize, Py_None);
164:
+165: self._maxsize = maxsize if maxsize is not None else -1
__pyx_t_1 = (__pyx_v_maxsize != Py_None);
if (__pyx_t_1) {
__pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_maxsize); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L1_error)
__pyx_t_6 = __pyx_t_7;
} else {
__pyx_t_6 = -1L;
}
__pyx_v_self->_maxsize = __pyx_t_6;
166: # Explicitly maintain order for getters and putters that block
167: # so that callers can consistently rely on getting things out
168: # in the apparent order they went in. This was once required by
169: # imap_unordered. Previously these were set() objects, and the
170: # items put in the set have default hash() and eq() methods;
171: # under CPython, since new objects tend to have increasing
172: # hash values, this tended to roughly maintain order anyway,
173: # but that's not true under PyPy. An alternative to a deque
174: # (to avoid the linear scan of remove()) might be an
175: # OrderedDict, but it's 2.7 only; we don't expect to have so
176: # many waiters that removing an arbitrary element is a
177: # bottleneck, though.
+178: self.getters = collections.deque()
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_deque); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_8, __pyx__function); __pyx_t_9 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->getters); __Pyx_DECREF(__pyx_v_self->getters); __pyx_v_self->getters = __pyx_t_5; __pyx_t_5 = 0;
+179: self.putters = collections.deque()
__pyx_t_8 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_deque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_8); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_9 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->putters); __Pyx_DECREF(__pyx_v_self->putters); __pyx_v_self->putters = __pyx_t_5; __pyx_t_5 = 0;
+180: self.hub = get_hub()
__pyx_t_5 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(__pyx_v_self->hub); __Pyx_DECREF(__pyx_v_self->hub); __pyx_v_self->hub = __pyx_t_5; __pyx_t_5 = 0;
+181: self._event_unlock = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_event_unlock); __Pyx_DECREF(__pyx_v_self->_event_unlock); __pyx_v_self->_event_unlock = Py_None;
+182: self.is_shutdown = False
__pyx_v_self->is_shutdown = 0;
183:
+184: self.queue = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->queue); __Pyx_DECREF(__pyx_v_self->queue); __pyx_v_self->queue = Py_None;
+185: if items:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_items); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 185, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L7; }
186: # The *items* argument is unique to gevent, not in the
187: # stdlib. So when we monkey-patch ourself in, we won't
188: # expect to get called with that argument. To be compatible with
189: # stdlib subclasses that define ``def _init(self, maxsize)``
190: # detect this case and call with the same signature.
+191: self._init(maxsize, items)
__pyx_t_3 = ((PyObject *)__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_maxsize, __pyx_v_items};
__pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
192: else:
+193: self._init(maxsize)
/*else*/ {
__pyx_t_3 = ((PyObject *)__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_maxsize};
__pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init_2, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_L7:;
194:
195: # The stdlib queue class defines four bottleneck methods that
196: # subclasses override, we want to try to support them as
197: # best we can:
198: #
199: # * _init to initialize the queue attribute
200: # * _qsize to count the elements
201: # *_put to add an item
202: # *_get to remove and return an item.
203:
+204: def _init(self, maxsize, items=()): # pylint: disable=unused-argument
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_3_init(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_cqueue_11SimpleQueue_2_init, "SimpleQueue._init(self, maxsize, items=())"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_3_init = {"_init", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_3_init, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_2_init}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_3_init(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 ) { CYTHON_UNUSED PyObject *__pyx_v_maxsize = 0; PyObject *__pyx_v_items = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_maxsize,&__pyx_mstate_global->__pyx_n_u_items,0}; PyObject* values[2] = {0,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 204, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 204, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 204, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_init", 0) < 0) __PYX_ERR(0, 204, __pyx_L3_error) if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple)); for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_init", 0, 1, 2, i); __PYX_ERR(0, 204, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 204, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 204, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple)); } __pyx_v_maxsize = values[0]; __pyx_v_items = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_init", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 204, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._init", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_2_init(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_2_init(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items) { PyObject *__pyx_r = NULL; /* … */ /* 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_cqueue.SimpleQueue._init", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_3_init, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__init, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4]); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_init_2, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_empty_tuple); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);
+205: self.queue = self._create_queue(items)
__pyx_t_2.__pyx_n = 1; __pyx_t_2.items = __pyx_v_items; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_create_queue(__pyx_v_self, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->queue); __Pyx_DECREF(__pyx_v_self->queue); __pyx_v_self->queue = __pyx_t_1; __pyx_t_1 = 0;
206:
+207: def _qsize(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static Py_ssize_t __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__qsize(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
Py_ssize_t __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_qsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __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_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._qsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_4_qsize, "SimpleQueue._qsize(self) -> Py_ssize_t");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize = {"_qsize", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_4_qsize};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_qsize (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_4_qsize(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_4_qsize(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__qsize(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L1_error)
__pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._qsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_5_qsize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__qsize, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_qsize, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+208: return len(self.queue)
__pyx_t_1 = __pyx_v_self->queue; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_6; goto __pyx_L0;
209:
+210: def _get(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__get(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7_get)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._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_cqueue_11SimpleQueue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_6_get, "SimpleQueue._get(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_7_get = {"_get", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7_get, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_6_get};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_get (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_6_get(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_6_get(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __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_cqueue.SimpleQueue._get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_7_get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__get, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_2) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+211: return self.queue.popleft()
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_v_self->queue; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
212:
+213: def _put(self, item):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_9_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__put(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_9_put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._put", __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_cqueue_11SimpleQueue_9_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_8_put, "SimpleQueue._put(self, item)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_9_put = {"_put", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_9_put, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_8_put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_9_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_put (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_8_put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_8_put(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __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_cqueue.SimpleQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_9_put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_put, __pyx_t_2) < 0) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+214: self.queue.append(item)
__pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->queue, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error)
215:
+216: def _create_queue(self, items=()):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue(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_cqueue_11SimpleQueue__create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue__create_queue *__pyx_optional_args) {
PyObject *__pyx_v_items = ((PyObject *)__pyx_mstate_global->__pyx_empty_tuple);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_items = __pyx_optional_args->items;
}
}
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_create_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_items};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._create_queue", __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_cqueue_11SimpleQueue_11_create_queue(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_cqueue_11SimpleQueue_10_create_queue, "SimpleQueue._create_queue(self, items=())");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue = {"_create_queue", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_10_create_queue};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue(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_items = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_create_queue (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 216, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 216, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_create_queue", 0) < 0) __PYX_ERR(0, 216, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
} else {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 216, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
}
__pyx_v_items = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 216, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_10_create_queue(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_items);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_10_create_queue(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_items) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.items = __pyx_v_items;
__pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cqueue_SimpleQueue->_create_queue(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __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_cqueue.SimpleQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_11_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__create_queue, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 216, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_create_queue, __pyx_t_2) < 0) __PYX_ERR(0, 216, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+217: return collections.deque(items)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_deque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_items}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
218:
+219: def _peek(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__peek(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._peek", __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_cqueue_11SimpleQueue_13_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_12_peek, "SimpleQueue._peek(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek = {"_peek", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_12_peek};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_peek (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_12_peek(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_12_peek(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__peek(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __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_cqueue.SimpleQueue._peek", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_13_peek, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__peek, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_peek, __pyx_t_2) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+220: return self.queue[0]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->queue, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
221:
+222: @property
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize___get__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize___get__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.maxsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
223: def maxsize(self):
+224: return self._maxsize if self._maxsize > 0 else None
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = (__pyx_v_self->_maxsize > 0); if (__pyx_t_2) { __pyx_t_3 = PyLong_FromSsize_t(__pyx_v_self->_maxsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
225:
+226: @maxsize.setter
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_nv); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_nv) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_2__set__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), ((PyObject *)__pyx_v_nv));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_7maxsize_2__set__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_nv) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.maxsize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
227: def maxsize(self, nv):
228: # QQQ make maxsize into a property with setter that schedules unlock if necessary
+229: if nv is None or nv <= 0:
__pyx_t_2 = (__pyx_v_nv == Py_None);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_3 = PyObject_RichCompare(__pyx_v_nv, __pyx_mstate_global->__pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 229, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+230: self._maxsize = -1
__pyx_v_self->_maxsize = -1L;
231: else:
+232: self._maxsize = nv
/*else*/ {
__pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nv); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
__pyx_v_self->_maxsize = __pyx_t_4;
}
__pyx_L3:;
233:
+234: def copy(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_14copy, "SimpleQueue.copy(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_15copy = {"copy", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_15copy, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_14copy}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_15copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_14copy(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_14copy(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* 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_cqueue.SimpleQueue.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_15copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_copy, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_2) < 0) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+235: return type(self)(self.maxsize, self.queue)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __pyx_t_3 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_maxsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_4, __pyx_v_self->queue}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
236:
+237: def __repr__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_17__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_17__repr__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_16__repr__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_16__repr__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* 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_cqueue.SimpleQueue.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+238: return '<%s at %s%s>' % (type(self).__name__, hex(id(self)), self._format())
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_5[1] = __pyx_t_2; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_at; __pyx_t_5[3] = __pyx_t_1; __pyx_t_5[4] = __pyx_t_3; __pyx_t_5[5] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 6, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
239:
+240: def __str__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_19__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_19__str__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_18__str__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_18__str__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* 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_cqueue.SimpleQueue.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+241: return '<%s%s>' % (type(self).__name__, self._format())
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_4[1] = __pyx_t_2; __pyx_t_4[2] = __pyx_t_1; __pyx_t_4[3] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, 1 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
242:
+243: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_21_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_20_format, "SimpleQueue._format(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_21_format = {"_format", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_21_format, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_20_format}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_21_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_20_format(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_20_format(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._format", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_21_format, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__format, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_format, __pyx_t_2) < 0) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+244: result = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+245: if self.maxsize is not None:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+246: result.append('maxsize=%r' % (self.maxsize, ))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_maxsize_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+247: if getattr(self, 'queue', None):
__pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_queue, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+248: result.append('queue=%r' % (self.queue, ))
__pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_self->queue), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_queue_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+249: if self.getters:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 249, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+250: result.append('getters[%s]' % len(self.getters))
__pyx_t_3 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_getters_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+251: if self.putters:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 251, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+252: result.append('putters[%s]' % len(self.putters))
__pyx_t_1 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyLong_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_putters_s, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_4 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+253: if result:
__pyx_t_2 = (__Pyx_PyList_GET_SIZE(__pyx_v_result) != 0); if (unlikely(((!CYTHON_ASSUME_SAFE_MACROS) && __pyx_t_2 < 0))) __PYX_ERR(0, 253, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+254: return ' ' + ' '.join(result)
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__3, __pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u__3, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+255: return ''
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4); __pyx_r = __pyx_mstate_global->__pyx_kp_u__4; goto __pyx_L0;
256:
+257: def qsize(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static Py_ssize_t __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_qsize(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
Py_ssize_t __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_qsize_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 257, __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_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.qsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_22qsize, "SimpleQueue.qsize(self) -> Py_ssize_t\n\nReturn the size of the queue.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize = {"qsize", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_22qsize};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("qsize (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_22qsize(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_22qsize(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_qsize(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error)
__pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.qsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_23qsize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_qsize, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_qsize_2, __pyx_t_2) < 0) __PYX_ERR(0, 257, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
258: """Return the size of the queue."""
+259: return self._qsize()
__pyx_t_6 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L1_error)
__pyx_r = __pyx_t_6;
goto __pyx_L0;
260:
+261: def __len__(self):
/* Python wrapper */ static Py_ssize_t __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_25__len__(PyObject *__pyx_v_self); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_24__len__, "SimpleQueue.__len__(self)\n\nReturn the size of the queue. This is the same as :meth:`qsize`.\n\n.. versionadded: 1.1b3\n\n Previously, getting len() of a queue would raise a TypeError."); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_6gevent_14_gevent_cqueue_11SimpleQueue_24__len__; #endif static Py_ssize_t __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_25__len__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_24__len__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_24__len__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) { Py_ssize_t __pyx_r; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; return __pyx_r; }
262: """
263: Return the size of the queue. This is the same as :meth:`qsize`.
264:
265: .. versionadded: 1.1b3
266:
267: Previously, getting len() of a queue would raise a TypeError.
268: """
269:
+270: return self.qsize()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
__pyx_r = __pyx_t_1;
goto __pyx_L0;
271:
+272: def __bool__(self):
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_27__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_27__bool__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_26__bool__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_26__bool__(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
273: """
274: A queue object is always True.
275:
276: .. versionadded: 1.1b3
277:
278: Now that queues support len(), they need to implement ``__bool__``
279: to return True for backwards compatibility.
280: """
+281: return True
__pyx_r = 1; goto __pyx_L0;
282:
+283: def empty(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_29empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static int __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_empty(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
int __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_29empty)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 283, __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_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_29empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_28empty, "SimpleQueue.empty(self) -> bool\n\nReturn ``True`` if the queue is empty, ``False`` otherwise.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_29empty = {"empty", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_29empty, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_28empty};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_29empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("empty (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_28empty(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_28empty(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_empty(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.empty", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_29empty, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_empty, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_empty, __pyx_t_2) < 0) __PYX_ERR(0, 283, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
284: """Return ``True`` if the queue is empty, ``False`` otherwise."""
+285: return not self.qsize()
__pyx_t_7 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error)
__pyx_r = (!(__pyx_t_7 != 0));
goto __pyx_L0;
286:
+287: def full(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_31full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static int __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_full(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
int __pyx_r;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_31full)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 287, __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_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.full", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_31full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_30full, "SimpleQueue.full(self) -> bool\n\nReturn ``True`` if the queue is full, ``False`` otherwise.\n\n``Queue(None)`` is never full.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_31full = {"full", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_31full, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_30full};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_31full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("full (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_30full(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_30full(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_full(__pyx_v_self, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.full", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_31full, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_full, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_full, __pyx_t_2) < 0) __PYX_ERR(0, 287, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
288: """Return ``True`` if the queue is full, ``False`` otherwise.
289:
290: ``Queue(None)`` is never full.
291: """
+292: return self._maxsize > 0 and self.qsize() >= self._maxsize
__pyx_t_7 = (__pyx_v_self->_maxsize > 0);
if (__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L3_bool_binop_done;
}
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_8 >= __pyx_v_self->_maxsize);
__pyx_t_6 = __pyx_t_7;
__pyx_L3_bool_binop_done:;
__pyx_r = __pyx_t_6;
goto __pyx_L0;
293:
+294: def put(self, item, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_33put(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_cqueue_11SimpleQueue_put(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_put *__pyx_optional_args) {
PyObject *__pyx_v_block = ((PyObject *)Py_True);
PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
PyObject *__pyx_v_getter = NULL;
struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *__pyx_v_waiter = NULL;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
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;
}
}
}
__Pyx_INCREF(__pyx_v_timeout);
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_33put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_item, __pyx_v_block, __pyx_v_timeout};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_getter);
__Pyx_XDECREF((PyObject *)__pyx_v_waiter);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_timeout);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_33put(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_cqueue_11SimpleQueue_32put, "SimpleQueue.put(self, item, block=True, timeout=None)\n\nPut an item into the queue.\n\nIf optional arg *block* is true and *timeout* is ``None`` (the default),\nblock if necessary until a free slot is available. If *timeout* is\na positive number, it blocks at most *timeout* seconds and raises\nthe :class:`Full` exception if no free slot was available within that time.\nOtherwise (*block* is false), put an item on the queue if a free slot\nis immediately available, else raise the :class:`Full` exception (*timeout*\nis ignored in that case).\n\n... versionchanged:: 24.10.1\n Now raises a ``ValueError`` for a negative *timeout* in the cases\n that CPython does.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_33put = {"put", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_33put, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_32put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_33put(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_item = 0;
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_timeout = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("put (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 294, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 294, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 294, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 294, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "put", 0) < 0) __PYX_ERR(0, 294, __pyx_L3_error)
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, i); __PYX_ERR(0, 294, __pyx_L3_error) }
}
} else {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 294, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 294, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 294, __pyx_L3_error)
break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_item = values[0];
__pyx_v_block = values[1];
__pyx_v_timeout = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 294, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_32put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_32put(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
PyObject *__pyx_r = NULL;
__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_cqueue_SimpleQueue->put(__pyx_v_self, __pyx_v_item, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __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_cqueue.SimpleQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_33put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[5]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_put_2, __pyx_t_2) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(2, Py_True, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 294, __pyx_L1_error)
__Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);
295: """
296: Put an item into the queue.
297:
298: If optional arg *block* is true and *timeout* is ``None`` (the default),
299: block if necessary until a free slot is available. If *timeout* is
300: a positive number, it blocks at most *timeout* seconds and raises
301: the :class:`Full` exception if no free slot was available within that time.
302: Otherwise (*block* is false), put an item on the queue if a free slot
303: is immediately available, else raise the :class:`Full` exception (*timeout*
304: is ignored in that case).
305:
306: ... versionchanged:: 24.10.1
307: Now raises a ``ValueError`` for a negative *timeout* in the cases
308: that CPython does.
309: """
+310: if self.is_shutdown:
if (unlikely(__pyx_v_self->is_shutdown)) {
/* … */
}
+311: raise ShutDown
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 311, __pyx_L1_error)
+312: if self._maxsize == -1 or self.qsize() < self._maxsize:
__pyx_t_7 = (__pyx_v_self->_maxsize == -1L);
if (!__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 312, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_8 < __pyx_v_self->_maxsize);
__pyx_t_6 = __pyx_t_7;
__pyx_L5_bool_binop_done:;
if (__pyx_t_6) {
/* … */
}
313: # there's a free slot, put an item right away.
314: # For compatibility with CPython, verify that the timeout is non-negative.
+315: if block and timeout is not None and timeout < 0:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 315, __pyx_L1_error) if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L8_bool_binop_done; } __pyx_t_7 = (__pyx_v_timeout != Py_None); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L8_bool_binop_done; } __pyx_t_1 = PyObject_RichCompare(__pyx_v_timeout, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_7; __pyx_L8_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* … */ }
+316: raise ValueError("'timeout' must be a non-negative number")
__pyx_t_2 = NULL;
__Pyx_INCREF(__pyx_builtin_ValueError);
__pyx_t_4 = __pyx_builtin_ValueError;
__pyx_t_5 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_timeout_must_be_a_non_negative};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 316, __pyx_L1_error)
+317: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+318: if self.getters:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 318, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+319: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+320: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
321:
+322: if self.hub is getcurrent(): # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_cqueue_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { /* … */ }
323: # We're in the mainloop, so we cannot wait; we can switch to other greenlets though.
324: # Check if possible to get a free slot in the queue.
+325: while self.getters and self.qsize() and self.qsize() >= self._maxsize:
while (1) {
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 325, __pyx_L1_error)
if (__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L15_bool_binop_done;
}
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_8 != 0);
if (__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L15_bool_binop_done;
}
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_8 >= __pyx_v_self->_maxsize);
__pyx_t_6 = __pyx_t_7;
__pyx_L15_bool_binop_done:;
if (!__pyx_t_6) break;
+326: getter = self.getters.popleft()
__pyx_t_4 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_1);
__pyx_t_1 = 0;
+327: getter.switch(getter)
__pyx_t_4 = __pyx_v_getter;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_getter};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
+328: if self.qsize() < self._maxsize:
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 328, __pyx_L1_error)
__pyx_t_6 = (__pyx_t_8 < __pyx_v_self->_maxsize);
if (__pyx_t_6) {
/* … */
}
+329: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+330: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+331: raise Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 331, __pyx_L1_error)
332:
+333: if block:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 333, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+334: waiter = ItemWaiter(item, self)
__pyx_t_4 = NULL;
__Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_ItemWaiter);
__pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_ItemWaiter);
__pyx_t_5 = 1;
{
PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_item, ((PyObject *)__pyx_v_self)};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
__Pyx_GOTREF((PyObject *)__pyx_t_1);
}
__pyx_v_waiter = ((struct __pyx_obj_6gevent_14_gevent_cqueue_ItemWaiter *)__pyx_t_1);
__pyx_t_1 = 0;
+335: self.putters.append(waiter)
__pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_self->putters, ((PyObject *)__pyx_v_waiter)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 335, __pyx_L1_error)
+336: timeout = Timeout._start_new_or_dummy(timeout, Full)
__pyx_t_2 = __pyx_v_6gevent_14_gevent_cqueue_Timeout;
__Pyx_INCREF(__pyx_t_2);
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_timeout, __pyx_t_4};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start_new_or_dummy, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1);
__pyx_t_1 = 0;
+337: try:
/*try:*/ {
+338: if self.getters:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 338, __pyx_L21_error) if (__pyx_t_6) { /* … */ }
+339: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+340: result = waiter.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_ItemWaiter *)__pyx_v_waiter->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_waiter), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+341: if result is not waiter:
__pyx_t_6 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter));
if (unlikely(__pyx_t_6)) {
/* … */
}
}
+342: raise InvalidSwitchError("Invalid switch into Queue.put: %r" % (result, ))
__pyx_t_4 = NULL;
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError);
__pyx_t_2 = __pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError;
__pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_result), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L21_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_switch_into_Queue_put, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 342, __pyx_L21_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
assert(__pyx_t_4);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_10};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L21_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 342, __pyx_L21_error)
343: finally:
+344: timeout.cancel()
/*finally:*/ {
/*normal exit:*/{
__pyx_t_2 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
__pyx_t_1 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L26_error)
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+345: _safe_remove(self.putters, waiter)
__pyx_t_1 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __pyx_f_6gevent_14_gevent_cqueue__safe_remove(__pyx_t_1, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L22;
}
__pyx_L21_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_18);
__Pyx_XGOTREF(__pyx_t_19);
__pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
{
/* … */
__pyx_t_2 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue__safe_remove(__pyx_t_2, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 345, __pyx_L26_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_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
__pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
goto __pyx_L1_error;
__pyx_L26_error:;
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
goto __pyx_L1_error;
}
__pyx_L22:;
}
+346: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
347:
+348: raise Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 348, __pyx_L1_error)
349:
+350: def put_nowait(self, item):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_put_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.put_nowait", __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_cqueue_11SimpleQueue_35put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_34put_nowait, "SimpleQueue.put_nowait(self, item)\n\nPut an item into the queue without blocking.\n\nOnly enqueue the item if a free slot is immediately available.\nOtherwise raise the :class:`Full` exception.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait = {"put_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_34put_nowait};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("put_nowait (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_34put_nowait(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_34put_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_put_nowait(__pyx_v_self, __pyx_v_item, 1); 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;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.put_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_35put_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_put_nowait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_put_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
351: """Put an item into the queue without blocking.
352:
353: Only enqueue the item if a free slot is immediately available.
354: Otherwise raise the :class:`Full` exception.
355: """
+356: self.put(item, False)
__pyx_t_6.__pyx_n = 1; __pyx_t_6.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->put(__pyx_v_self, __pyx_v_item, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
357:
+358: def __get_or_peek(self, method, block, timeout):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__SimpleQueue__get_or_peek(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *__pyx_v_waiter = NULL;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_timeout);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._SimpleQueue__get_or_peek", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_waiter);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_timeout);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
359: # Internal helper method. The `method` should be either
360: # self._get when called from self.get() or self._peek when
361: # called from self.peek(). Call this after the initial check
362: # to see if there are items in the queue.
363:
+364: if self.is_shutdown:
if (unlikely(__pyx_v_self->is_shutdown)) {
/* … */
}
+365: raise ShutDown
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 365, __pyx_L1_error)
366:
+367: if block and timeout is not None and timeout < 0:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 367, __pyx_L1_error) if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = (__pyx_v_timeout != Py_None); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = PyObject_RichCompare(__pyx_v_timeout, __pyx_mstate_global->__pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 367, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_2)) { /* … */ }
+368: raise ValueError("'timeout' must be a non-negative number")
__pyx_t_4 = NULL;
__Pyx_INCREF(__pyx_builtin_ValueError);
__pyx_t_5 = __pyx_builtin_ValueError;
__pyx_t_6 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_timeout_must_be_a_non_negative};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 368, __pyx_L1_error)
+369: if self.hub is getcurrent(): # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_cqueue_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
370: # special case to make get_nowait() or peek_nowait() runnable in the mainloop greenlet
371: # there are no items in the queue; try to fix the situation by unlocking putters
+372: while self.putters:
while (1) {
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 372, __pyx_L1_error)
if (!__pyx_t_2) break;
373: # Note: get() used popleft(), peek used pop(); popleft
374: # is almost certainly correct.
+375: self.putters.popleft().put_and_switch()
__pyx_t_7 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_7);
__pyx_t_6 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
__pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
}
__pyx_t_5 = __pyx_t_4;
__Pyx_INCREF(__pyx_t_5);
__pyx_t_6 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_put_and_switch, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+376: if self.qsize():
__pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L1_error)
__pyx_t_2 = (__pyx_t_8 != 0);
if (__pyx_t_2) {
/* … */
}
}
+377: return method()
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_method); __pyx_t_5 = __pyx_v_method; __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_5, __pyx__function); __pyx_t_6 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+378: raise Empty
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 378, __pyx_L1_error)
379:
+380: if not block:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 380, __pyx_L1_error) __pyx_t_3 = (!__pyx_t_2); if (unlikely(__pyx_t_3)) { /* … */ }
381: # We can't block, we're not the hub, and we have nothing
382: # to return. No choice but to raise the Empty exception.
383: #
384: # CAUTION: Calling ``q.get(False)`` in a tight loop won't
385: # work like it does in CPython where it should eventually
386: # let another thread make progress, because there's never
387: # a chance to switch greenlets here. We don't sleep()
388: # to enforce that, as that would be a significant behaviour
389: # change.
+390: raise Empty
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 390, __pyx_L1_error)
391:
+392: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_5 = NULL; __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_1); } __pyx_v_waiter = ((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+393: timeout = Timeout._start_new_or_dummy(timeout, Empty)
__pyx_t_4 = __pyx_v_6gevent_14_gevent_cqueue_Timeout; __Pyx_INCREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_timeout, __pyx_t_5}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start_new_or_dummy, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+394: try:
/*try:*/ {
+395: self.getters.append(waiter)
__pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_self->getters, ((PyObject *)__pyx_v_waiter)); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 395, __pyx_L14_error)
+396: if self.putters:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 396, __pyx_L14_error) if (__pyx_t_3) { /* … */ }
+397: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+398: result = waiter.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+399: if result is not waiter:
__pyx_t_3 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter));
if (unlikely(__pyx_t_3)) {
/* … */
}
+400: raise InvalidSwitchError('Invalid switch into Queue.get: %r' % (result, ))
__pyx_t_5 = NULL;
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError);
__pyx_t_4 = __pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError;
__pyx_t_7 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_result), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 400, __pyx_L14_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_switch_into_Queue_get, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 400, __pyx_L14_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_6 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_5);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_6 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L14_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 400, __pyx_L14_error)
+401: return method()
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_method); __pyx_t_10 = __pyx_v_method; __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_10))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_10, __pyx__function); __pyx_t_6 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L13_return; }
402: finally:
+403: timeout.cancel()
/*finally:*/ {
__pyx_L14_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_14);
__Pyx_XGOTREF(__pyx_t_15);
__Pyx_XGOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_18);
__Pyx_XGOTREF(__pyx_t_19);
__pyx_t_11 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
{
__pyx_t_10 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_10);
__pyx_t_6 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L19_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
__pyx_t_1 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_6 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
__pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 403, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+404: _safe_remove(self.getters, waiter)
__pyx_t_1 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_10 = __pyx_f_6gevent_14_gevent_cqueue__safe_remove(__pyx_t_1, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 404, __pyx_L19_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_XGIVEREF(__pyx_t_15);
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
__pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
goto __pyx_L1_error;
__pyx_L19_error:;
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
__pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
goto __pyx_L1_error;
}
__pyx_L13_return: {
__pyx_t_19 = __pyx_r;
__pyx_r = 0;
/* … */
__pyx_t_10 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_10);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue__safe_remove(__pyx_t_10, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_19;
__pyx_t_19 = 0;
goto __pyx_L0;
}
}
405:
+406: def get(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_37get(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_cqueue_11SimpleQueue_get(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_get *__pyx_optional_args) {
PyObject *__pyx_v_block = ((PyObject *)Py_True);
PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
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 (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_37get)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_block, __pyx_v_timeout};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.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_cqueue_11SimpleQueue_37get(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_cqueue_11SimpleQueue_36get, "SimpleQueue.get(self, block=True, timeout=None)\n\nRemove and return an item from the queue.\n\nIf optional args *block* is true and *timeout* is ``None`` (the default),\nblock if necessary until an item is available. If *timeout* is a positive number,\nit blocks at most *timeout* seconds and raises the :class:`Empty` exception\nif no item was available within that time. Otherwise (*block* is false), return\nan item if one is immediately available, else raise the :class:`Empty` exception\n(*timeout* is ignored in that case).");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_37get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_37get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_36get};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_37get(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 Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 406, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 406, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 406, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < 0) __PYX_ERR(0, 406, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
} else {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 406, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 406, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_block = values[0];
__pyx_v_timeout = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("get", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 406, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_36get(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_36get(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
PyObject *__pyx_r = NULL;
__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_cqueue_SimpleQueue->get(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __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_cqueue.SimpleQueue.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_37get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_get, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[6]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_get_2, __pyx_t_2) < 0) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(2, Py_True, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(0, 406, __pyx_L1_error)
__Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);
407: """
408: Remove and return an item from the queue.
409:
410: If optional args *block* is true and *timeout* is ``None`` (the default),
411: block if necessary until an item is available. If *timeout* is a positive number,
412: it blocks at most *timeout* seconds and raises the :class:`Empty` exception
413: if no item was available within that time. Otherwise (*block* is false), return
414: an item if one is immediately available, else raise the :class:`Empty` exception
415: (*timeout* is ignored in that case).
416: """
+417: if self.qsize():
__pyx_t_6 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_6 != 0);
if (__pyx_t_7) {
/* … */
}
+418: if self.putters:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 418, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+419: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+420: return self._get()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
421:
+422: return self.__get_or_peek(self._get, block, timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_SimpleQueue__get_or_peek(__pyx_v_self, __pyx_t_1, __pyx_v_block, __pyx_v_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __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;
423:
+424: def get_nowait(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_get_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.get_nowait", __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_cqueue_11SimpleQueue_39get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_38get_nowait, "SimpleQueue.get_nowait(self)\n\nRemove and return an item from the queue without blocking.\n\nOnly get an item if one is immediately available. Otherwise\nraise the :class:`Empty` exception.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait = {"get_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_38get_nowait};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_nowait (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_38get_nowait(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_38get_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_get_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __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_cqueue.SimpleQueue.get_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_39get_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_get_nowait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_get_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 424, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
425: """Remove and return an item from the queue without blocking.
426:
427: Only get an item if one is immediately available. Otherwise
428: raise the :class:`Empty` exception.
429: """
+430: return self.get(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_6.__pyx_n = 1; __pyx_t_6.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
431:
+432: def peek(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_41peek(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_cqueue_11SimpleQueue_peek(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_11SimpleQueue_peek *__pyx_optional_args) {
PyObject *__pyx_v_block = ((PyObject *)Py_True);
PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
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 (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_peek_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_41peek)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_block, __pyx_v_timeout};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.peek", __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_cqueue_11SimpleQueue_41peek(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_cqueue_11SimpleQueue_40peek, "SimpleQueue.peek(self, block=True, timeout=None)\n\nReturn an item from the queue without removing it.\n\nIf optional args *block* is true and *timeout* is ``None`` (the default),\nblock if necessary until an item is available. If *timeout* is a positive number,\nit blocks at most *timeout* seconds and raises the :class:`Empty` exception\nif no item was available within that time. Otherwise (*block* is false), return\nan item if one is immediately available, else raise the :class:`Empty` exception\n(*timeout* is ignored in that case).");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_41peek = {"peek", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_41peek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_40peek};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_41peek(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 Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("peek (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 432, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 432, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 432, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "peek", 0) < 0) __PYX_ERR(0, 432, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
} else {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 432, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 432, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_block = values[0];
__pyx_v_timeout = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("peek", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 432, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.peek", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_40peek(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_40peek(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
PyObject *__pyx_r = NULL;
__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_cqueue_SimpleQueue->peek(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __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_cqueue.SimpleQueue.peek", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_41peek, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_peek, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[7]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_peek_2, __pyx_t_2) < 0) __PYX_ERR(0, 432, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(2, Py_True, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(0, 432, __pyx_L1_error)
__Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);
433: """Return an item from the queue without removing it.
434:
435: If optional args *block* is true and *timeout* is ``None`` (the default),
436: block if necessary until an item is available. If *timeout* is a positive number,
437: it blocks at most *timeout* seconds and raises the :class:`Empty` exception
438: if no item was available within that time. Otherwise (*block* is false), return
439: an item if one is immediately available, else raise the :class:`Empty` exception
440: (*timeout* is ignored in that case).
441: """
+442: if self.qsize():
__pyx_t_6 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error)
__pyx_t_7 = (__pyx_t_6 != 0);
if (__pyx_t_7) {
/* … */
}
443: # This doesn't schedule an unlock like get() does because we're not
444: # actually making any space.
+445: return self._peek()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_peek(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
446:
+447: return self.__get_or_peek(self._peek, block, timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_SimpleQueue__get_or_peek(__pyx_v_self, __pyx_t_1, __pyx_v_block, __pyx_v_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __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;
448:
+449: def peek_nowait(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_peek_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_peek_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.peek_nowait", __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_cqueue_11SimpleQueue_43peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_42peek_nowait, "SimpleQueue.peek_nowait(self)\n\nReturn an item from the queue without blocking.\n\nOnly return an item if one is immediately available. Otherwise\nraise the :class:`Empty` exception.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait = {"peek_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_42peek_nowait};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("peek_nowait (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_42peek_nowait(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_42peek_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue_peek_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __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_cqueue.SimpleQueue.peek_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_43peek_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue_peek_nowait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_peek_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
450: """Return an item from the queue without blocking.
451:
452: Only return an item if one is immediately available. Otherwise
453: raise the :class:`Empty` exception.
454: """
+455: return self.peek(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_6.__pyx_n = 1; __pyx_t_6.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->peek(__pyx_v_self, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
456:
+457: def _unlock(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_45_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_44_unlock, "SimpleQueue._unlock(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_45_unlock = {"_unlock", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_45_unlock, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_11SimpleQueue_44_unlock}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_45_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_44_unlock(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_44_unlock(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) { int __pyx_v_repeat; PyObject *__pyx_v_putter = NULL; PyObject *__pyx_v_getter = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._unlock", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_putter); __Pyx_XDECREF(__pyx_v_getter); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_11SimpleQueue_45_unlock, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_SimpleQueue__unlock, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue, __pyx_mstate_global->__pyx_n_u_unlock, __pyx_t_2) < 0) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+458: while True:
while (1) {
+459: repeat = False
__pyx_v_repeat = 0;
+460: if self.putters and (self._maxsize == -1 or self.qsize() < self._maxsize):
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 460, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L6_bool_binop_done; } __pyx_t_2 = (__pyx_v_self->_maxsize == -1L); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L6_bool_binop_done; } __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) __pyx_t_2 = (__pyx_t_3 < __pyx_v_self->_maxsize); __pyx_t_1 = __pyx_t_2; __pyx_L6_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+461: repeat = True
__pyx_v_repeat = 1;
+462: try:
{
/*try:*/ {
/* … */
}
/* … */
__pyx_L11_except_error:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L1_error;
__pyx_L10_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
__pyx_L16_try_end:;
}
+463: putter = self.putters.popleft()
__pyx_t_8 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_8);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
__pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 463, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_7);
}
__Pyx_XDECREF_SET(__pyx_v_putter, __pyx_t_7);
__pyx_t_7 = 0;
+464: self._put(putter.item)
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_mstate_global->__pyx_n_u_item); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 464, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_t_7, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 464, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+465: except: # pylint:disable=bare-except
/*except:*/ {
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._unlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_10) < 0) __PYX_ERR(0, 465, __pyx_L11_except_error)
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_7);
__Pyx_XGOTREF(__pyx_t_10);
+466: putter.throw(*sys.exc_info())
if (unlikely(!__pyx_v_putter)) { __Pyx_RaiseUnboundLocalError("putter"); __PYX_ERR(0, 466, __pyx_L11_except_error) }
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_mstate_global->__pyx_n_u_throw); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_13 = NULL;
__Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_14);
__pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_mstate_global->__pyx_n_u_exc_info); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
__pyx_t_9 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_15))) {
__pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15);
assert(__pyx_t_13);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
__Pyx_INCREF(__pyx_t_13);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
__pyx_t_9 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_13, NULL};
__pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_12);
}
__pyx_t_15 = __Pyx_PySequence_Tuple(__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_15);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 466, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L10_exception_handled;
}
467: else:
+468: putter.switch(putter)
/*else:*/ {
__pyx_t_7 = __pyx_v_putter;
__Pyx_INCREF(__pyx_t_7);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_putter};
__pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 468, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_8);
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L16_try_end;
__pyx_L9_error:;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+469: if self.getters and self.qsize():
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 469, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 469, __pyx_L1_error) __pyx_t_2 = (__pyx_t_3 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L20_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+470: repeat = True
__pyx_v_repeat = 1;
+471: getter = self.getters.popleft()
__pyx_t_7 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_7);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
__pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_9, (1-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 471, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
}
__Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_10);
__pyx_t_10 = 0;
+472: getter.switch(getter)
__pyx_t_7 = __pyx_v_getter;
__Pyx_INCREF(__pyx_t_7);
__pyx_t_9 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_getter};
__pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+473: if not repeat:
__pyx_t_1 = (!__pyx_v_repeat);
if (__pyx_t_1) {
/* … */
}
}
+474: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
475:
+476: def _schedule_unlock(self):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__schedule_unlock(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue._schedule_unlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+477: if not self._event_unlock:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_event_unlock); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 477, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+478: self._event_unlock = self.hub.loop.run_callback(self._unlock)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_mstate_global->__pyx_n_u_loop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_unlock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_event_unlock); __Pyx_DECREF(__pyx_v_self->_event_unlock); __pyx_v_self->_event_unlock = __pyx_t_3; __pyx_t_3 = 0;
479:
+480: def __iter__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_47__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_47__iter__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_46__iter__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_46__iter__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+481: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
482:
+483: def __next__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_49__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_11SimpleQueue_49__next__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_48__next__(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_11SimpleQueue_48__next__(struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *__pyx_v_self) {
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("gevent._gevent_cqueue.SimpleQueue.__next__", __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;
}
+484: result = self.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+485: if result is StopIteration:
__pyx_t_2 = (__pyx_v_result == __pyx_builtin_StopIteration);
if (unlikely(__pyx_t_2)) {
/* … */
}
+486: raise result
__Pyx_Raise(__pyx_v_result, 0, 0, 0); __PYX_ERR(0, 486, __pyx_L1_error)
+487: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
488:
489:
+490: class Queue(SimpleQueue):
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue {
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_SimpleQueue __pyx_base;
PyObject *(*_did_put_task)(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *);
PyObject *(*shutdown)(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_5Queue_shutdown *__pyx_optional_args);
PyObject *(*_drain_for_immediate_shutdown)(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *);
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *__pyx_vtabptr_6gevent_14_gevent_cqueue_Queue;
491: """
492: A subclass of :class:`SimpleQueue` that additionally has
493: :meth:`task_done` and :meth:`join` methods.
494:
495: .. versionchanged:: 25.4.1
496: Renamed from ``JoinablQueue`` to simply ``Queue`` to better
497: match the capability of the standard library :class:`queue.Queue`.
498: """
499:
500: __slots__ = (
+501: '_cond',
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[8]) < 0) __PYX_ERR(0, 500, __pyx_L1_error) /* … */ __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_cond_2, __pyx_mstate_global->__pyx_n_u_unfinished_tasks); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);
502: 'unfinished_tasks',
503: )
504:
+505: def __init__(self, maxsize=None, items=(), unfinished_tasks=None):
/* Python wrapper */ static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_5Queue___init__, "\n\n .. versionchanged:: 1.1a1\n If *unfinished_tasks* is not given, then all the given *items*\n (if any) will be considered unfinished.\n\n "); #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_6gevent_14_gevent_cqueue_5Queue___init__; #endif static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_maxsize = 0; PyObject *__pyx_v_items = 0; PyObject *__pyx_v_unfinished_tasks = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_maxsize,&__pyx_mstate_global->__pyx_n_u_items,&__pyx_mstate_global->__pyx_n_u_unfinished_tasks,0}; PyObject* values[3] = {0,0,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 505, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 505, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple)); if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 505, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple)); if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); } __pyx_v_maxsize = values[0]; __pyx_v_items = values[1]; __pyx_v_unfinished_tasks = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 505, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("gevent._gevent_cqueue.Queue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue___init__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items, __pyx_v_unfinished_tasks); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_14_gevent_cqueue_5Queue___init__(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items, PyObject *__pyx_v_unfinished_tasks) { PyObject *__pyx_v_Event = NULL; int __pyx_r; /* … */ /* 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_4); __Pyx_AddTraceback("gevent._gevent_cqueue.Queue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_Event); __Pyx_RefNannyFinishContext(); return __pyx_r; }
506: """
507:
508: .. versionchanged:: 1.1a1
509: If *unfinished_tasks* is not given, then all the given *items*
510: (if any) will be considered unfinished.
511:
512: """
+513: SimpleQueue.__init__(self, maxsize, items, _warn_depth=3)
__pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, ((PyObject *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items}; __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_warn_depth, __pyx_mstate_global->__pyx_int_3, __pyx_t_4, __pyx_callargs+4, 0) < 0) __PYX_ERR(0, 513, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_3, (4-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
514:
+515: from gevent.event import Event
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Event); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Event); if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_Event) != (0)) __PYX_ERR(0, 515, __pyx_L1_error); __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent_event, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Event); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_Event = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+516: self._cond = Event()
__pyx_t_1 = NULL; __Pyx_INCREF(__pyx_v_Event); __pyx_t_2 = __pyx_v_Event; __pyx_t_3 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); assert(__pyx_t_1); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); __pyx_t_3 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cevent_Event))))) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF((PyObject *)__pyx_v_self->_cond); __Pyx_DECREF((PyObject *)__pyx_v_self->_cond); __pyx_v_self->_cond = ((struct __pyx_obj_6gevent_14_gevent_cevent_Event *)__pyx_t_4); __pyx_t_4 = 0;
+517: self._cond.set()
__pyx_t_2 = ((PyObject *)__pyx_v_self->_cond); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
518:
+519: if unfinished_tasks:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_unfinished_tasks); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 519, __pyx_L1_error) if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+520: self.unfinished_tasks = unfinished_tasks
__pyx_t_6 = __Pyx_PyLong_As_int(__pyx_v_unfinished_tasks); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L1_error) __pyx_v_self->unfinished_tasks = __pyx_t_6;
+521: elif items:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_items); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 521, __pyx_L1_error) if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+522: self.unfinished_tasks = len(items)
__pyx_t_7 = PyObject_Length(__pyx_v_items); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 522, __pyx_L1_error) __pyx_v_self->unfinished_tasks = __pyx_t_7;
523: else:
+524: self.unfinished_tasks = 0
/*else*/ {
__pyx_v_self->unfinished_tasks = 0;
}
__pyx_L3:;
525:
+526: if self.unfinished_tasks:
__pyx_t_5 = (__pyx_v_self->unfinished_tasks != 0);
if (__pyx_t_5) {
/* … */
}
+527: self._cond.clear()
__pyx_t_2 = ((PyObject *)__pyx_v_self->_cond);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_clear, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 527, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
528:
+529: def copy(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_5Queue_2copy, "Queue.copy(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_3copy = {"copy", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_3copy, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_2copy}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_2copy(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_2copy(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* 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_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._gevent_cqueue.Queue.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue_copy, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_2) < 0) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+530: return type(self)(self.maxsize, self.queue, self.unfinished_tasks)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __pyx_t_3 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_maxsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_self->unfinished_tasks); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_6 = 0; } #endif { PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_4, __pyx_v_self->__pyx_base.queue, __pyx_t_5}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (4-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
531:
+532: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_5_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_5Queue_4_format, "Queue._format(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_5_format = {"_format", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_5_format, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_4_format}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_5_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_4_format(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_4_format(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._gevent_cqueue.Queue._format", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_5_format, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue__format, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_format, __pyx_t_2) < 0) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+533: result = SimpleQueue._format(self)
__pyx_t_2 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_SimpleQueue); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_self)}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+534: if self.unfinished_tasks:
__pyx_t_4 = (__pyx_v_self->unfinished_tasks != 0);
if (__pyx_t_4) {
/* … */
}
+535: result += ' tasks=%s _cond=%s' % (self.unfinished_tasks, self._cond)
__pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_self->unfinished_tasks, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(((PyObject *)__pyx_v_self->_cond)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_tasks; __pyx_t_5[1] = __pyx_t_1; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_cond; __pyx_t_5[3] = __pyx_t_2; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, 7 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0;
+536: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
537:
+538: def _put(self, item):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_5Queue__put(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_5Queue_7_put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.Queue._put", __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_cqueue_5Queue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_5Queue_6_put, "Queue._put(self, item)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_7_put = {"_put", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_7_put, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_6_put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_put (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_6_put(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self), ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_6_put(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_5Queue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __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_cqueue.Queue._put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_7_put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue__put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_put, __pyx_t_2) < 0) __PYX_ERR(0, 538, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+539: SimpleQueue._put(self, item)
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_11SimpleQueue__put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+540: self._did_put_task()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self->__pyx_base.__pyx_vtab)->_did_put_task(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
541:
+542: def _did_put_task(self):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_5Queue__did_put_task(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* 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_cqueue.Queue._did_put_task", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+543: self.unfinished_tasks += 1
__pyx_v_self->unfinished_tasks = (__pyx_v_self->unfinished_tasks + 1);
+544: self._cond.clear()
__pyx_t_2 = ((PyObject *)__pyx_v_self->_cond); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_clear, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
545:
+546: def task_done(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_9task_done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_5Queue_8task_done, "Queue.task_done(self)\n\nIndicate that a formerly enqueued task is complete. Used by queue consumer threads.\nFor each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to\n:meth:`task_done` tells the queue that the processing on the task is complete.\n\nIf a :meth:`join` is currently blocking, it will resume when all items have been processed\n(meaning that a :meth:`task_done` call was received for every item that had been\n:meth:`put <Queue.put>` into the queue).\n\nRaises a :exc:`ValueError` if called more times than there were items placed in the queue."); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_9task_done = {"task_done", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_9task_done, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_8task_done}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_9task_done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("task_done (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_8task_done(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_8task_done(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* 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_AddTraceback("gevent._gevent_cqueue.Queue.task_done", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_9task_done, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue_task_done, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_task_done, __pyx_t_2) < 0) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
547: '''Indicate that a formerly enqueued task is complete. Used by queue consumer threads.
548: For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to
549: :meth:`task_done` tells the queue that the processing on the task is complete.
550:
551: If a :meth:`join` is currently blocking, it will resume when all items have been processed
552: (meaning that a :meth:`task_done` call was received for every item that had been
553: :meth:`put <Queue.put>` into the queue).
554:
555: Raises a :exc:`ValueError` if called more times than there were items placed in the queue.
556: '''
+557: if self.unfinished_tasks <= 0:
__pyx_t_1 = (__pyx_v_self->unfinished_tasks <= 0);
if (unlikely(__pyx_t_1)) {
/* … */
}
+558: raise ValueError('task_done() called too many times')
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_builtin_ValueError);
__pyx_t_4 = __pyx_builtin_ValueError;
__pyx_t_5 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_task_done_called_too_many_times};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__PYX_ERR(0, 558, __pyx_L1_error)
+559: self.unfinished_tasks -= 1
__pyx_v_self->unfinished_tasks = (__pyx_v_self->unfinished_tasks - 1);
+560: if self.unfinished_tasks == 0:
__pyx_t_1 = (__pyx_v_self->unfinished_tasks == 0);
if (__pyx_t_1) {
/* … */
}
+561: self._cond.set()
__pyx_t_4 = ((PyObject *)__pyx_v_self->_cond);
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
562:
+563: def join(self, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_11join(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_cqueue_5Queue_10join, "Queue.join(self, timeout=None)\n\nBlock until all items in the queue have been gotten and processed.\n\nThe count of unfinished tasks goes up whenever an item is added to the queue.\nThe count goes down whenever a consumer thread calls :meth:`task_done` to indicate\nthat the item was retrieved and all work on it is complete. When the count of\nunfinished tasks drops to zero, :meth:`join` unblocks.\n\n:param float timeout: If not ``None``, then wait no more than this time in seconds\n for all tasks to finish.\n:return: ``True`` if all tasks have finished; if ``timeout`` was given and expired before\n all tasks finished, ``False``.\n\n.. versionchanged:: 1.1a1\n Add the *timeout* parameter."); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_11join = {"join", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_11join, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_10join}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_11join(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 Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_timeout,0}; PyObject* values[1] = {0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 563, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 563, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "join", 0) < 0) __PYX_ERR(0, 563, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 563, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None)); } __pyx_v_timeout = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("join", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 563, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("gevent._gevent_cqueue.Queue.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_10join(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_10join(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_cqueue.Queue.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_11join, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue_join, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[9]); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_join, __pyx_t_2) < 0) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);
564: '''
565: Block until all items in the queue have been gotten and processed.
566:
567: The count of unfinished tasks goes up whenever an item is added to the queue.
568: The count goes down whenever a consumer thread calls :meth:`task_done` to indicate
569: that the item was retrieved and all work on it is complete. When the count of
570: unfinished tasks drops to zero, :meth:`join` unblocks.
571:
572: :param float timeout: If not ``None``, then wait no more than this time in seconds
573: for all tasks to finish.
574: :return: ``True`` if all tasks have finished; if ``timeout`` was given and expired before
575: all tasks finished, ``False``.
576:
577: .. versionchanged:: 1.1a1
578: Add the *timeout* parameter.
579: '''
+580: return self._cond.wait(timeout=timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_v_self->_cond); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_timeout, __pyx_v_timeout, __pyx_t_4, __pyx_callargs+1, 0) < 0) __PYX_ERR(0, 580, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_wait, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
581:
+582: def shutdown(self, immediate=False):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_13shutdown(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_cqueue_5Queue_shutdown(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_5Queue_shutdown *__pyx_optional_args) {
PyObject *__pyx_v_immediate = ((PyObject *)Py_False);
PyObject *__pyx_v_getters = NULL;
PyObject *__pyx_v_putters = NULL;
PyObject *__pyx_v_waiter = NULL;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_immediate = __pyx_optional_args->immediate;
}
}
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_shutdown); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_5Queue_13shutdown)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_immediate};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("gevent._gevent_cqueue.Queue.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_getters);
__Pyx_XDECREF(__pyx_v_putters);
__Pyx_XDECREF(__pyx_v_waiter);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_13shutdown(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_cqueue_5Queue_12shutdown, "Queue.shutdown(self, immediate=False)\n\n\"Shut-down the queue, making queue gets and puts raise\n`ShutDown`.\n\nBy default, gets will only raise once the queue is empty. Set\n*immediate* to True to make gets raise immediately instead.\n\nAll blocked callers of `put` and `get` will be unblocked.\n\nIn joinable queues, if *immediate*, a task is marked as done\nfor each item remaining in the queue, which may unblock\ncallers of `join`.");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_5Queue_13shutdown = {"shutdown", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_5Queue_13shutdown, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_5Queue_12shutdown};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_5Queue_13shutdown(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_immediate = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("shutdown (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_immediate,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 582, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 582, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "shutdown", 0) < 0) __PYX_ERR(0, 582, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
} else {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 582, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False));
}
__pyx_v_immediate = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("shutdown", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 582, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.Queue.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_5Queue_12shutdown(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self), __pyx_v_immediate);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_5Queue_12shutdown(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self, PyObject *__pyx_v_immediate) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.immediate = __pyx_v_immediate;
__pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cqueue_Queue->shutdown(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __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_cqueue.Queue.shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_5Queue_13shutdown, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Queue_shutdown, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[10]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue, __pyx_mstate_global->__pyx_n_u_shutdown, __pyx_t_2) < 0) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 582, __pyx_L1_error)
__Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);
583: """
584: "Shut-down the queue, making queue gets and puts raise
585: `ShutDown`.
586:
587: By default, gets will only raise once the queue is empty. Set
588: *immediate* to True to make gets raise immediately instead.
589:
590: All blocked callers of `put` and `get` will be unblocked.
591:
592: In joinable queues, if *immediate*, a task is marked as done
593: for each item remaining in the queue, which may unblock
594: callers of `join`.
595: """
+596: self.is_shutdown = True
__pyx_v_self->__pyx_base.is_shutdown = 1;
+597: if immediate:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_immediate); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 597, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+598: self._drain_for_immediate_shutdown()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self->__pyx_base.__pyx_vtab)->_drain_for_immediate_shutdown(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+599: getters = list(self.getters)
__pyx_t_1 = PySequence_List(__pyx_v_self->__pyx_base.getters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_getters = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+600: putters = list(self.putters)
__pyx_t_1 = PySequence_List(__pyx_v_self->__pyx_base.putters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_putters = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+601: self.getters.clear()
__pyx_t_2 = __pyx_v_self->__pyx_base.getters; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_clear, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+602: self.putters.clear()
__pyx_t_2 = __pyx_v_self->__pyx_base.putters; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_clear, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+603: for waiter in getters + putters:
__pyx_t_1 = PyNumber_Add(__pyx_v_getters, __pyx_v_putters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 603, __pyx_L1_error) #endif if (__pyx_t_7 >= __pyx_temp) break; } __pyx_t_1 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_7); ++__pyx_t_7; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_waiter, __pyx_t_1); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+604: self.hub.loop.run_callback(waiter.throw, ShutDown)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.hub, __pyx_mstate_global->__pyx_n_u_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_waiter, __pyx_mstate_global->__pyx_n_u_throw); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_ShutDown); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_8, __pyx_t_9}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
605:
+606: def _drain_for_immediate_shutdown(self):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_5Queue__drain_for_immediate_shutdown(struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.Queue._drain_for_immediate_shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+607: while self.qsize():
while (1) {
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.qsize(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 607, __pyx_L1_error)
__pyx_t_2 = (__pyx_t_1 != 0);
if (!__pyx_t_2) break;
+608: self.get()
__pyx_t_3 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+609: self.task_done()
__pyx_t_4 = ((PyObject *)__pyx_v_self);
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_task_done, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
610:
611: #: .. versionchanged:: 25.4.1
612: #: Now a BWC alias
+613: JoinableQueue = Queue
if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_JoinableQueue, ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue)) < 0) __PYX_ERR(0, 613, __pyx_L1_error)
614:
+615: class UnboundQueue(Queue):
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_UnboundQueue {
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue __pyx_base;
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_UnboundQueue *__pyx_vtabptr_6gevent_14_gevent_cqueue_UnboundQueue;
616: # A specialization of Queue that knows it can never
617: # be bound. Changing its maxsize has no effect.
618:
+619: __slots__ = ()
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_UnboundQueue, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_empty_tuple) < 0) __PYX_ERR(0, 619, __pyx_L1_error)
620:
+621: def __init__(self, maxsize=None, items=()):
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_maxsize = 0;
PyObject *__pyx_v_items = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_maxsize,&__pyx_mstate_global->__pyx_n_u_items,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 621, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 621, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 621, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 621, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
} else {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 621, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 621, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
}
__pyx_v_maxsize = values[0];
__pyx_v_items = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 621, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.UnboundQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_12UnboundQueue___init__(((struct __pyx_obj_6gevent_14_gevent_cqueue_UnboundQueue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_12UnboundQueue___init__(struct __pyx_obj_6gevent_14_gevent_cqueue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.UnboundQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+622: if maxsize is not None:
__pyx_t_1 = (__pyx_v_maxsize != Py_None);
if (unlikely(__pyx_t_1)) {
/* … */
}
+623: raise ValueError("UnboundQueue has no maxsize")
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_builtin_ValueError);
__pyx_t_4 = __pyx_builtin_ValueError;
__pyx_t_5 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_UnboundQueue_has_no_maxsize};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__PYX_ERR(0, 623, __pyx_L1_error)
+624: Queue.__init__(self, maxsize, items)
__pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Queue); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+625: self.putters = None # Will never be used.
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx_base.putters); __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx_base.putters); __pyx_v_self->__pyx_base.__pyx_base.putters = Py_None;
626:
+627: def put(self, item, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_3put(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_cqueue_12UnboundQueue_put(struct __pyx_obj_6gevent_14_gevent_cqueue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_12UnboundQueue_put *__pyx_optional_args) {
PyObject *__pyx_v_block = ((PyObject *)Py_True);
PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
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 (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_UnboundQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_3put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_item, __pyx_v_block, __pyx_v_timeout};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.UnboundQueue.put", __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_cqueue_12UnboundQueue_3put(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_cqueue_12UnboundQueue_2put, "UnboundQueue.put(self, item, block=True, timeout=None)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_12UnboundQueue_3put = {"put", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_3put, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_12UnboundQueue_2put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_12UnboundQueue_3put(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_item = 0;
PyObject *__pyx_v_block = 0;
PyObject *__pyx_v_timeout = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("put (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 627, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 627, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 627, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 627, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "put", 0) < 0) __PYX_ERR(0, 627, __pyx_L3_error)
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, i); __PYX_ERR(0, 627, __pyx_L3_error) }
}
} else {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 627, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 627, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 627, __pyx_L3_error)
break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_item = values[0];
__pyx_v_block = values[1];
__pyx_v_timeout = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 627, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.UnboundQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_12UnboundQueue_2put(((struct __pyx_obj_6gevent_14_gevent_cqueue_UnboundQueue *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_12UnboundQueue_2put(struct __pyx_obj_6gevent_14_gevent_cqueue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
PyObject *__pyx_r = NULL;
__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_cqueue_UnboundQueue->__pyx_base.__pyx_base.put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_item, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __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_cqueue.UnboundQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_12UnboundQueue_3put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_UnboundQueue_put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[11]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_UnboundQueue, __pyx_mstate_global->__pyx_n_u_put_2, __pyx_t_2) < 0) __PYX_ERR(0, 627, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
__pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(2, Py_True, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 627, __pyx_L1_error)
__Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
__Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);
/* … */
struct __pyx_opt_args_6gevent_14_gevent_cqueue_12UnboundQueue_put {
int __pyx_n;
PyObject *block;
PyObject *timeout;
};
+628: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_UnboundQueue *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._put(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+629: if self.getters:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->__pyx_base.__pyx_base.getters); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 629, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+630: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_UnboundQueue *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._schedule_unlock(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
631:
632:
+633: class PriorityQueue(Queue):
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_PriorityQueue {
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue __pyx_base;
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_vtabptr_6gevent_14_gevent_cqueue_PriorityQueue;
634: '''A subclass of :class:`Queue` that retrieves entries in priority order (lowest first).
635:
636: Entries are typically tuples of the form: ``(priority number, data)``.
637:
638: .. versionchanged:: 1.2a1
639: Any *items* given to the constructor will now be passed through
640: :func:`heapq.heapify` to ensure the invariants of this class hold.
641: Previously it was just assumed that they were already a heap.
642: '''
643:
+644: __slots__ = ()
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_empty_tuple) < 0) __PYX_ERR(0, 644, __pyx_L1_error)
645:
+646: def _create_queue(self, items=()):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue(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_cqueue_13PriorityQueue__create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_13PriorityQueue__create_queue *__pyx_optional_args) {
PyObject *__pyx_v_items = ((PyObject *)__pyx_mstate_global->__pyx_empty_tuple);
PyObject *__pyx_v_q = NULL;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_items = __pyx_optional_args->items;
}
}
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_create_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_items};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.PriorityQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_q);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue(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_cqueue_13PriorityQueue__create_queue, "PriorityQueue._create_queue(self, items=())");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue = {"_create_queue", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_13PriorityQueue__create_queue};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue(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_items = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_create_queue (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 646, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 646, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_create_queue", 0) < 0) __PYX_ERR(0, 646, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
} else {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 646, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
}
__pyx_v_items = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 646, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.PriorityQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue__create_queue(((struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *)__pyx_v_self), __pyx_v_items);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue__create_queue(struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_items) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.items = __pyx_v_items;
__pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cqueue_PriorityQueue->__pyx_base.__pyx_base._create_queue(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __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_cqueue.PriorityQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_1_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PriorityQueue__create_queue, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue, __pyx_mstate_global->__pyx_n_u_create_queue, __pyx_t_2) < 0) __PYX_ERR(0, 646, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
struct __pyx_opt_args_6gevent_14_gevent_cqueue_13PriorityQueue__create_queue {
int __pyx_n;
PyObject *items;
};
+647: q = list(items)
__pyx_t_1 = PySequence_List(__pyx_v_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_q = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+648: _heapify(q)
__pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue__heapify); __pyx_t_4 = __pyx_v_6gevent_14_gevent_cqueue__heapify; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_q}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+649: return q
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_q); __pyx_r = __pyx_v_q; goto __pyx_L0;
650:
+651: def _put(self, item):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_13PriorityQueue__put(struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_3_put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 651, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.PriorityQueue._put", __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_cqueue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_13PriorityQueue_2_put, "PriorityQueue._put(self, item)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_3_put = {"_put", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_3_put, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_13PriorityQueue_2_put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_put (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue_2_put(((struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue_2_put(struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_13PriorityQueue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __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_cqueue.PriorityQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_3_put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PriorityQueue__put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 651, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue, __pyx_mstate_global->__pyx_n_u_put, __pyx_t_2) < 0) __PYX_ERR(0, 651, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+652: _heappush(self.queue, item)
__pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue__heappush); __pyx_t_4 = __pyx_v_6gevent_14_gevent_cqueue__heappush; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_self->__pyx_base.__pyx_base.queue, __pyx_v_item}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+653: self._did_put_task()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_PriorityQueue *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._did_put_task(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
654:
+655: def _get(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_13PriorityQueue__get(struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_5_get)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.PriorityQueue._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_cqueue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_13PriorityQueue_4_get, "PriorityQueue._get(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_5_get = {"_get", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_5_get, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_13PriorityQueue_4_get};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_get (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue_4_get(((struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_13PriorityQueue_4_get(struct __pyx_obj_6gevent_14_gevent_cqueue_PriorityQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_13PriorityQueue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __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_cqueue.PriorityQueue._get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_13PriorityQueue_5_get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PriorityQueue__get, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_PriorityQueue, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_2) < 0) __PYX_ERR(0, 655, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+656: return _heappop(self.queue)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue__heappop); __pyx_t_4 = __pyx_v_6gevent_14_gevent_cqueue__heappop; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_4, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_self->__pyx_base.__pyx_base.queue}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
657:
658:
+659: class LifoQueue(Queue):
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_LifoQueue {
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Queue __pyx_base;
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_LifoQueue *__pyx_vtabptr_6gevent_14_gevent_cqueue_LifoQueue;
660: """
661: A subclass of :class:`JoinableQueue` that retrieves most recently added entries first.
662:
663: .. versionchanged:: 24.10.1
664: Now extends :class:`JoinableQueue` instead of just :class:`Queue`.
665:
666: """
+667: __slots__ = ()
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_empty_tuple) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
668:
+669: def _create_queue(self, items=()):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue(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_cqueue_9LifoQueue__create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_9LifoQueue__create_queue *__pyx_optional_args) {
PyObject *__pyx_v_items = ((PyObject *)__pyx_mstate_global->__pyx_empty_tuple);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_items = __pyx_optional_args->items;
}
}
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_create_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_items};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.LifoQueue._create_queue", __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_cqueue_9LifoQueue_1_create_queue(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_cqueue_9LifoQueue__create_queue, "LifoQueue._create_queue(self, items=())");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue = {"_create_queue", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue__create_queue};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue(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_items = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_create_queue (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 669, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 669, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_create_queue", 0) < 0) __PYX_ERR(0, 669, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
} else {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 669, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_empty_tuple));
}
__pyx_v_items = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 669, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.LifoQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue__create_queue(((struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *)__pyx_v_self), __pyx_v_items);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue__create_queue(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_items) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.items = __pyx_v_items;
__pyx_t_1 = __pyx_vtabptr_6gevent_14_gevent_cqueue_LifoQueue->__pyx_base.__pyx_base._create_queue(((struct __pyx_obj_6gevent_14_gevent_cqueue_SimpleQueue *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __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_cqueue.LifoQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_1_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LifoQueue__create_queue, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[4]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue, __pyx_mstate_global->__pyx_n_u_create_queue, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
struct __pyx_opt_args_6gevent_14_gevent_cqueue_9LifoQueue__create_queue {
int __pyx_n;
PyObject *items;
};
+670: return list(items)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PySequence_List(__pyx_v_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
671:
+672: def _put(self, item):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__put(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_3_put)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 672, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.LifoQueue._put", __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_cqueue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_2_put, "LifoQueue._put(self, item)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_3_put = {"_put", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_3_put, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_2_put};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_put (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_2_put(((struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_2_put(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __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_cqueue.LifoQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_3_put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LifoQueue__put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 672, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue, __pyx_mstate_global->__pyx_n_u_put, __pyx_t_2) < 0) __PYX_ERR(0, 672, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+673: self.queue.append(item)
__pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->__pyx_base.__pyx_base.queue, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 673, __pyx_L1_error)
+674: self._did_put_task()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_LifoQueue *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base._did_put_task(((struct __pyx_obj_6gevent_14_gevent_cqueue_Queue *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
675:
+676: def _get(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__get(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_5_get)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.LifoQueue._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_cqueue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_4_get, "LifoQueue._get(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_5_get = {"_get", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_5_get, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_4_get};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_get (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_4_get(((struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_4_get(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __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_cqueue.LifoQueue._get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_5_get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LifoQueue__get, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_2) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+677: return self.queue.pop()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_self->__pyx_base.__pyx_base.queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
678:
+679: def _peek(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__peek(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_7_peek)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.LifoQueue._peek", __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_cqueue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_6_peek, "LifoQueue._peek(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_7_peek = {"_peek", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_7_peek, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_9LifoQueue_6_peek};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_peek (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_6_peek(((struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_9LifoQueue_6_peek(struct __pyx_obj_6gevent_14_gevent_cqueue_LifoQueue *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_9LifoQueue__peek(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __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_cqueue.LifoQueue._peek", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_9LifoQueue_7_peek, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_LifoQueue__peek, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 679, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_LifoQueue, __pyx_mstate_global->__pyx_n_u_peek, __pyx_t_2) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+680: return self.queue[-1]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.__pyx_base.queue, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
681:
682:
+683: class Channel:
struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel {
PyObject *(*get)(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_7Channel_get *__pyx_optional_args);
PyObject *(*get_nowait)(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *, int __pyx_skip_dispatch);
PyObject *(*_schedule_unlock)(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *);
};
static struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel *__pyx_vtabptr_6gevent_14_gevent_cqueue_Channel;
684: """
685: A queue-like object that can only hold one item at a
686: time.
687:
688: This is commonly used as a synchronization primitive,
689: and is implemented efficiently for this use-case.
690:
691: .. versionchanged:: 25.4.2
692: Make this class subscriptable.
693: """
694:
695: __slots__ = (
+696: 'getters',
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_slots, __pyx_mstate_global->__pyx_tuple[12]) < 0) __PYX_ERR(0, 695, __pyx_L1_error) /* … */ __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(5, __pyx_mstate_global->__pyx_n_u_getters, __pyx_mstate_global->__pyx_n_u_putters, __pyx_mstate_global->__pyx_n_u_hub, __pyx_mstate_global->__pyx_n_u_event_unlock, __pyx_mstate_global->__pyx_n_u_weakref); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);
697: 'putters',
698: 'hub',
699: '_event_unlock',
700: '__weakref__',
701: )
702:
+703: __class_getitem__ = classmethod(types.GenericAlias)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_GenericAlias); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_class_getitem, __pyx_t_2) < 0) __PYX_ERR(0, 703, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
704:
+705: def __init__(self, maxsize=1):
/* Python wrapper */
static int __pyx_pw_6gevent_14_gevent_cqueue_7Channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6gevent_14_gevent_cqueue_7Channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_maxsize = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_maxsize,0};
PyObject* values[1] = {0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 705, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 705, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < 0) __PYX_ERR(0, 705, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
} else {
switch (__pyx_nargs) {
case 1:
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 705, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
}
__pyx_v_maxsize = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 705, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel___init__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self), __pyx_v_maxsize);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_6gevent_14_gevent_cqueue_7Channel___init__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, PyObject *__pyx_v_maxsize) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
706: # We take maxsize to simplify certain kinds of code
+707: if maxsize != 1:
__pyx_t_1 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_maxsize, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 707, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* … */ }
+708: raise ValueError("Channels have a maxsize of 1")
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_builtin_ValueError);
__pyx_t_4 = __pyx_builtin_ValueError;
__pyx_t_5 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Channels_have_a_maxsize_of_1};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__PYX_ERR(0, 708, __pyx_L1_error)
+709: self.getters = collections.deque()
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_deque); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_6, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->getters); __Pyx_DECREF(__pyx_v_self->getters); __pyx_v_self->getters = __pyx_t_2; __pyx_t_2 = 0;
+710: self.putters = collections.deque()
__pyx_t_6 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_deque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_6); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->putters); __Pyx_DECREF(__pyx_v_self->putters); __pyx_v_self->putters = __pyx_t_2; __pyx_t_2 = 0;
+711: self.hub = get_hub()
__pyx_t_2 = ((PyObject *)__pyx_f_6gevent_19_gevent_c_hub_local_get_hub_noargs(0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->hub); __Pyx_DECREF(__pyx_v_self->hub); __pyx_v_self->hub = __pyx_t_2; __pyx_t_2 = 0;
+712: self._event_unlock = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_event_unlock); __Pyx_DECREF(__pyx_v_self->_event_unlock); __pyx_v_self->_event_unlock = Py_None;
713:
+714: def __repr__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_3__repr__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_2__repr__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_2__repr__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* 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_cqueue.Channel.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+715: return '<%s at %s %s>' % (type(self).__name__, hex(id(self)), self._format())
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_5[1] = __pyx_t_2; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u_at; __pyx_t_5[3] = __pyx_t_1; __pyx_t_5[4] = __pyx_mstate_global->__pyx_kp_u__3; __pyx_t_5[5] = __pyx_t_3; __pyx_t_5[6] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 7, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 4 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
716:
+717: def __str__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_5__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_5__str__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_4__str__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_4__str__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* 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_cqueue.Channel.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+718: return '<%s %s>' % (type(self).__name__, self._format())
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4[0] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_4[1] = __pyx_t_2; __pyx_t_4[2] = __pyx_mstate_global->__pyx_kp_u__3; __pyx_t_4[3] = __pyx_t_1; __pyx_t_4[4] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, 1 * 3 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
719:
+720: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_7_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_6_format, "Channel._format(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_7_format = {"_format", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_7_format, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_6_format}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_7_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_6_format(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_6_format(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._gevent_cqueue.Channel._format", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_7_format, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel__format, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_format, __pyx_t_2) < 0) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+721: result = ''
__Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4);
__pyx_v_result = __pyx_mstate_global->__pyx_kp_u__4;
+722: if self.getters:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 722, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+723: result += ' getters[%s]' % len(self.getters)
__pyx_t_2 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 723, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_getters_s_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 723, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyUnicode_ConcatInPlace(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_2));
__pyx_t_2 = 0;
+724: if self.putters:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 724, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+725: result += ' putters[%s]' % len(self.putters)
__pyx_t_2 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 725, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyLong_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_putters_s_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 725, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __Pyx_PyUnicode_ConcatInPlace(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_2));
__pyx_t_2 = 0;
+726: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
727:
+728: @property
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_7balance_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_7balance_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_7balance___get__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_7balance___get__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.balance.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
729: def balance(self):
+730: return len(self.putters) - len(self.getters)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_v_self->putters; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_v_self->getters; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyLong_FromSsize_t((__pyx_t_2 - __pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
731:
+732: def qsize(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_9qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_8qsize, "Channel.qsize(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_9qsize = {"qsize", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_9qsize, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_8qsize}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_9qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_8qsize(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_8qsize(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_9qsize, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_qsize, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_qsize_2, __pyx_t_2) < 0) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+733: return 0
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __pyx_r = __pyx_mstate_global->__pyx_int_0; goto __pyx_L0;
734:
+735: def empty(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_11empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_10empty, "Channel.empty(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_11empty = {"empty", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_11empty, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_10empty}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_11empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_10empty(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_10empty(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_11empty, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_empty, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_empty, __pyx_t_2) < 0) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+736: return True
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0;
737:
+738: def full(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_13full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_12full, "Channel.full(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_13full = {"full", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_13full, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_12full}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_13full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_12full(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_12full(CYTHON_UNUSED struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_13full, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_full, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_full, __pyx_t_2) < 0) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+739: return True
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0;
740:
+741: def put(self, item, block=True, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_15put(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_cqueue_7Channel_14put, "Channel.put(self, item, block=True, timeout=None)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_15put = {"put", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_15put, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_14put}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_15put(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_item = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_item,&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0}; PyObject* values[3] = {0,0,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 741, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 741, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 741, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 741, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "put", 0) < 0) __PYX_ERR(0, 741, __pyx_L3_error) if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True)); if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, i); __PYX_ERR(0, 741, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 741, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 741, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 741, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_True)); if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None)); } __pyx_v_item = values[0]; __pyx_v_block = values[1]; __pyx_v_timeout = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 741, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("gevent._gevent_cqueue.Channel.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_14put(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_14put(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_v_getter = NULL; struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *__pyx_v_waiter = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_INCREF(__pyx_v_item); __Pyx_INCREF(__pyx_v_timeout); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("gevent._gevent_cqueue.Channel.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_getter); __Pyx_XDECREF((PyObject *)__pyx_v_waiter); __Pyx_XDECREF(__pyx_v_result); __Pyx_XDECREF(__pyx_v_item); __Pyx_XDECREF(__pyx_v_timeout); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_15put, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_put, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[13]); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_put_2, __pyx_t_2) < 0) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(2, Py_True, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);
+742: if self.hub is getcurrent(): # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_cqueue_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+743: if self.getters:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 743, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+744: getter = self.getters.popleft()
__pyx_t_3 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__pyx_v_getter = __pyx_t_1;
__pyx_t_1 = 0;
+745: getter.switch(item)
__pyx_t_3 = __pyx_v_getter;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_item};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+746: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+747: raise Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 747, __pyx_L1_error)
748:
+749: if not block:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 749, __pyx_L1_error) __pyx_t_5 = (!__pyx_t_2); if (__pyx_t_5) { /* … */ }
+750: timeout = 0
__Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_mstate_global->__pyx_int_0);
751:
+752: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_3 = NULL; __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_6 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_1); } __pyx_v_waiter = ((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+753: item = (item, waiter)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_item) != (0)) __PYX_ERR(0, 753, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_waiter); __Pyx_GIVEREF((PyObject *)__pyx_v_waiter); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_waiter)) != (0)) __PYX_ERR(0, 753, __pyx_L1_error); __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1); __pyx_t_1 = 0;
+754: self.putters.append(item)
__pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->putters, __pyx_v_item); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 754, __pyx_L1_error)
+755: timeout = Timeout._start_new_or_dummy(timeout, Full)
__pyx_t_6 = __pyx_v_6gevent_14_gevent_cqueue_Timeout; __Pyx_INCREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Full); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_timeout, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start_new_or_dummy, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __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, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+756: try:
/*try:*/ {
{
/*try:*/ {
/* … */
}
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L14_try_end;
__pyx_L9_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
/* … */
__pyx_L11_except_error:;
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
goto __pyx_L7_error;
__pyx_L14_try_end:;
}
}
+757: if self.getters:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 757, __pyx_L9_error) if (__pyx_t_5) { /* … */ }
+758: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+759: result = waiter.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+760: if result is not waiter:
__pyx_t_5 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter));
if (unlikely(__pyx_t_5)) {
/* … */
}
+761: raise InvalidSwitchError("Invalid switch into Channel.put: %r" % (result, ))
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError);
__pyx_t_6 = __pyx_v_6gevent_14_gevent_cqueue_InvalidSwitchError;
__pyx_t_11 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_result), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 761, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_Invalid_switch_into_Channel_put, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 761, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_4 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_6))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
__pyx_t_4 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_12};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 761, __pyx_L9_error)
+762: except:
/*except:*/ {
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.put", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_12) < 0) __PYX_ERR(0, 762, __pyx_L11_except_error)
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_12);
+763: _safe_remove(self.putters, item)
__pyx_t_3 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_11 = __pyx_f_6gevent_14_gevent_cqueue__safe_remove(__pyx_t_3, __pyx_v_item); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 763, __pyx_L11_except_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+764: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_6, __pyx_t_12); __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_12 = 0; __PYX_ERR(0, 764, __pyx_L11_except_error) }
765: finally:
+766: timeout.cancel()
/*finally:*/ {
/*normal exit:*/{
__pyx_t_6 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_4 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
__pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 766, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
goto __pyx_L8;
}
__pyx_L7_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
if ( unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_8);
__Pyx_XGOTREF(__pyx_t_16);
__Pyx_XGOTREF(__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_18);
__pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
{
__pyx_t_6 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_4 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
__pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_cancel, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 766, __pyx_L20_error)
__Pyx_GOTREF(__pyx_t_12);
}
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
}
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_XGIVEREF(__pyx_t_8);
__Pyx_ErrRestore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
__pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
__pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
goto __pyx_L1_error;
__pyx_L20_error:;
__Pyx_XGIVEREF(__pyx_t_16);
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
goto __pyx_L1_error;
}
__pyx_L8:;
}
767:
+768: def put_nowait(self, item):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_17put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_16put_nowait, "Channel.put_nowait(self, item)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_17put_nowait = {"put_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_17put_nowait, METH_O, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_16put_nowait}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_17put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_16put_nowait(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_16put_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; /* … */ /* 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_cqueue.Channel.put_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_17put_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_put_nowait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_put_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+769: self.put(item, False)
__pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_item, Py_False}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_put_2, __pyx_callargs+__pyx_t_3, (3-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
770:
+771: def get(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_19get(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_cqueue_7Channel_get(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_14_gevent_cqueue_7Channel_get *__pyx_optional_args) {
PyObject *__pyx_v_block = ((PyObject *)Py_True);
PyObject *__pyx_v_timeout = ((PyObject *)Py_None);
PyObject *__pyx_v_item = NULL;
PyObject *__pyx_v_putter = NULL;
struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *__pyx_v_waiter = NULL;
PyObject *__pyx_r = NULL;
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;
}
}
}
__Pyx_INCREF(__pyx_v_timeout);
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_7Channel_19get)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_block, __pyx_v_timeout};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_item);
__Pyx_XDECREF(__pyx_v_putter);
__Pyx_XDECREF((PyObject *)__pyx_v_waiter);
__Pyx_XDECREF(__pyx_v_timeout);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_19get(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_cqueue_7Channel_18get, "Channel.get(self, block=True, timeout=None)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_19get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_19get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_18get};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_19get(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 Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_block,&__pyx_mstate_global->__pyx_n_u_timeout,0};
PyObject* values[2] = {0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 771, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 771, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 771, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "get", 0) < 0) __PYX_ERR(0, 771, __pyx_L3_error)
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
} else {
switch (__pyx_nargs) {
case 2:
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 771, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 1:
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 771, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_True));
if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_block = values[0];
__pyx_v_timeout = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("get", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 771, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_18get(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout);
/* function exit code */
for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
Py_XDECREF(values[__pyx_temp]);
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_18get(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) {
PyObject *__pyx_r = NULL;
__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_cqueue_Channel->get(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __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_cqueue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_19get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_get, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[14]);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_get_2, __pyx_t_2) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+772: if self.hub is getcurrent(): # pylint:disable=undefined-variable
__pyx_t_1 = ((PyObject *)__pyx_f_6gevent_14_gevent_cqueue_getcurrent()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { /* … */ }
+773: if self.putters:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 773, __pyx_L1_error) if (__pyx_t_6) { /* … */ }
+774: item, putter = self.putters.popleft()
__pyx_t_2 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
__PYX_ERR(0, 774, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_4);
} else {
__pyx_t_2 = __Pyx_PyList_GetItemRef(sequence, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_XGOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PyList_GetItemRef(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_XGOTREF(__pyx_t_4);
}
#else
__pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
__pyx_t_7 = NULL;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L6_unpacking_done;
__pyx_L5_unpacking_failed:;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
__PYX_ERR(0, 774, __pyx_L1_error)
__pyx_L6_unpacking_done:;
}
__pyx_v_item = __pyx_t_2;
__pyx_t_2 = 0;
__pyx_v_putter = __pyx_t_4;
__pyx_t_4 = 0;
+775: self.hub.loop.run_callback(putter.switch, putter)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_mstate_global->__pyx_n_u_loop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_mstate_global->__pyx_n_u_switch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_3, __pyx_v_putter}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+776: return item
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_item); __pyx_r = __pyx_v_item; goto __pyx_L0;
777:
+778: if not block:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 778, __pyx_L1_error) __pyx_t_8 = (!__pyx_t_6); if (__pyx_t_8) { /* … */ }
+779: timeout = 0
__Pyx_INCREF(__pyx_mstate_global->__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_mstate_global->__pyx_int_0);
780:
+781: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_2 = NULL; __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_6gevent_16_gevent_c_waiter_Waiter); __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_1); } __pyx_v_waiter = ((struct __pyx_obj_6gevent_16_gevent_c_waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+782: timeout = Timeout._start_new_or_dummy(timeout, Empty)
__pyx_t_3 = __pyx_v_6gevent_14_gevent_cqueue_Timeout; __Pyx_INCREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_timeout, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_start_new_or_dummy, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+783: try:
/*try:*/ {
{
/*try:*/ {
/* … */
}
__pyx_L11_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
/* … */
__pyx_L13_except_error:;
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
goto __pyx_L9_error;
__pyx_L15_try_return:;
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
goto __pyx_L8_return;
}
}
+784: self.getters.append(waiter)
__pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_self->getters, ((PyObject *)__pyx_v_waiter)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 784, __pyx_L11_error)
+785: if self.putters:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 785, __pyx_L11_error) if (__pyx_t_8) { /* … */ }
+786: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+787: return waiter.get()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_16_gevent_c_waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L15_try_return;
+788: except:
/*except:*/ {
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 788, __pyx_L13_except_error)
__Pyx_XGOTREF(__pyx_t_1);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
+789: self.getters.remove(waiter)
__pyx_t_13 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_13);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_13, ((PyObject *)__pyx_v_waiter)};
__pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_remove, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L13_except_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+790: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __PYX_ERR(0, 790, __pyx_L13_except_error) }
791: finally:
+792: timeout.close()
/*finally:*/ {
__pyx_L9_error:;
/*exception exit:*/{
__Pyx_PyThreadState_declare
__Pyx_PyThreadState_assign
__pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
if ( unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_11);
__Pyx_XGOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_9);
__Pyx_XGOTREF(__pyx_t_17);
__Pyx_XGOTREF(__pyx_t_18);
__Pyx_XGOTREF(__pyx_t_19);
__pyx_t_14 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename;
{
__pyx_t_2 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L21_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_9);
__Pyx_ErrRestore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
__pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
__pyx_lineno = __pyx_t_14; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16;
goto __pyx_L1_error;
__pyx_L21_error:;
__Pyx_XGIVEREF(__pyx_t_17);
__Pyx_XGIVEREF(__pyx_t_18);
__Pyx_XGIVEREF(__pyx_t_19);
__Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
goto __pyx_L1_error;
}
__pyx_L8_return: {
__pyx_t_19 = __pyx_r;
__pyx_r = 0;
__pyx_t_2 = __pyx_v_timeout;
__Pyx_INCREF(__pyx_t_2);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 792, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_19;
__pyx_t_19 = 0;
goto __pyx_L0;
}
}
793:
+794: def get_nowait(self):
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_7Channel_get_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_get_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_6gevent_14_gevent_cqueue_7Channel_21get_nowait)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.get_nowait", __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_cqueue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_20get_nowait, "Channel.get_nowait(self)");
static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_21get_nowait = {"get_nowait", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_21get_nowait, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_20get_nowait};
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_nowait (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_20get_nowait(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_20get_nowait(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_6gevent_14_gevent_cqueue_7Channel_get_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __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_cqueue.Channel.get_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_21get_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel_get_nowait, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_get_nowait, __pyx_t_2) < 0) __PYX_ERR(0, 794, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+795: return self.get(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_6.__pyx_n = 1; __pyx_t_6.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
796:
+797: def _unlock(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_23_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue_7Channel_22_unlock, "Channel._unlock(self)"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_7Channel_23_unlock = {"_unlock", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_7Channel_23_unlock, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue_7Channel_22_unlock}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_23_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_22_unlock(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_22_unlock(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) { PyObject *__pyx_v_getter = NULL; PyObject *__pyx_v_item = NULL; PyObject *__pyx_v_putter = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._gevent_cqueue.Channel._unlock", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_getter); __Pyx_XDECREF(__pyx_v_item); __Pyx_XDECREF(__pyx_v_putter); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_7Channel_23_unlock, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Channel__unlock, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_unlock, __pyx_t_2) < 0) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+798: while self.putters and self.getters:
while (1) {
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 798, __pyx_L1_error)
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 798, __pyx_L1_error)
__pyx_t_1 = __pyx_t_2;
__pyx_L5_bool_binop_done:;
if (!__pyx_t_1) break;
+799: getter = self.getters.popleft()
__pyx_t_4 = __pyx_v_self->getters;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_3);
__pyx_t_3 = 0;
+800: item, putter = self.putters.popleft()
__pyx_t_4 = __pyx_v_self->putters;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
__PYX_ERR(0, 800, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
__Pyx_INCREF(__pyx_t_4);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_6);
} else {
__pyx_t_4 = __Pyx_PyList_GetItemRef(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_XGOTREF(__pyx_t_4);
__pyx_t_6 = __Pyx_PyList_GetItemRef(sequence, 1);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_XGOTREF(__pyx_t_6);
}
#else
__pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 800, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 800, __pyx_L1_error)
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L8_unpacking_done;
__pyx_L7_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
__PYX_ERR(0, 800, __pyx_L1_error)
__pyx_L8_unpacking_done:;
}
__Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
__pyx_t_4 = 0;
__Pyx_XDECREF_SET(__pyx_v_putter, __pyx_t_6);
__pyx_t_6 = 0;
+801: getter.switch(item)
__pyx_t_6 = __pyx_v_getter;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_item};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+802: putter.switch(putter)
__pyx_t_6 = __pyx_v_putter;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_5 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_putter};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_switch, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
803:
+804: def _schedule_unlock(self):
static PyObject *__pyx_f_6gevent_14_gevent_cqueue_7Channel__schedule_unlock(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel._schedule_unlock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+805: if not self._event_unlock:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_event_unlock); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 805, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+806: self._event_unlock = self.hub.loop.run_callback(self._unlock)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_mstate_global->__pyx_n_u_loop); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_unlock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_run_callback, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_event_unlock); __Pyx_DECREF(__pyx_v_self->_event_unlock); __pyx_v_self->_event_unlock = __pyx_t_3; __pyx_t_3 = 0;
807:
+808: def __iter__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_25__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_25__iter__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_24__iter__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_24__iter__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+809: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
810:
+811: def __next__(self):
/* Python wrapper */
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_27__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_7Channel_27__next__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_6gevent_14_gevent_cqueue_7Channel_26__next__(((struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_6gevent_14_gevent_cqueue_7Channel_26__next__(struct __pyx_obj_6gevent_14_gevent_cqueue_Channel *__pyx_v_self) {
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("gevent._gevent_cqueue.Channel.__next__", __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;
}
+812: result = self.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_14_gevent_cqueue_Channel *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+813: if result is StopIteration:
__pyx_t_2 = (__pyx_v_result == __pyx_builtin_StopIteration);
if (unlikely(__pyx_t_2)) {
/* … */
}
+814: raise result
__Pyx_Raise(__pyx_v_result, 0, 0, 0); __PYX_ERR(0, 814, __pyx_L1_error)
+815: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
816:
+817: next = __next__ # Py2
__Pyx_GetNameInClass(__pyx_t_2, (PyObject*)__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_6gevent_14_gevent_cqueue_Channel, __pyx_mstate_global->__pyx_n_u_next_2, __pyx_t_2) < 0) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
818:
+819: def _init():
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_1_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_6gevent_14_gevent_cqueue__init, "_init()"); static PyMethodDef __pyx_mdef_6gevent_14_gevent_cqueue_1_init = {"_init", (PyCFunction)__pyx_pw_6gevent_14_gevent_cqueue_1_init, METH_NOARGS, __pyx_doc_6gevent_14_gevent_cqueue__init}; static PyObject *__pyx_pw_6gevent_14_gevent_cqueue_1_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_init (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_6gevent_14_gevent_cqueue__init(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_14_gevent_cqueue__init(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6gevent_14_gevent_cqueue_1_init, 0, __pyx_mstate_global->__pyx_n_u_init_2, NULL, __pyx_mstate_global->__pyx_n_u_gevent__gevent_cqueue, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_init_2, __pyx_t_2) < 0) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+820: greenlet_init() # pylint:disable=undefined-variable
__pyx_f_6gevent_14_gevent_cqueue_greenlet_init(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L1_error)
821:
+822: _init()
__pyx_t_7 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_init_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
823:
824:
+825: from gevent._util import import_c_accel
__pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_gevent__util, __pyx_t_2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_import_c_accel, __pyx_t_2) < 0) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+826: import_c_accel(globals(), 'gevent._queue')
__pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_import_c_accel); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_Globals(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gevent__queue}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (3-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;