Generated by Cython 0.29.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_d, __pyx_n_s_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: >>> queue = gevent.queue.Queue()
017: >>> queue.put(1)
018: >>> queue.put(2)
019: >>> queue.put(StopIteration)
020: >>> for item in queue:
021: ... print(item)
022: 1
023: 2
024:
025: .. versionchanged:: 1.0
026: ``Queue(0)`` now means queue of infinite size, not a channel. A :exc:`DeprecationWarning`
027: will be issued with this argument.
028: """
029:
030: from __future__ import absolute_import
+031: import sys
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+032: from heapq import heappush as _heappush
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_heappush_2); __Pyx_GIVEREF(__pyx_n_s_heappush_2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_heappush_2); __pyx_t_2 = __Pyx_Import(__pyx_n_s_heapq, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_heappush_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_6_queue__heappush); __Pyx_DECREF_SET(__pyx_v_6gevent_6_queue__heappush, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+033: from heapq import heappop as _heappop
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_heappop_2); __Pyx_GIVEREF(__pyx_n_s_heappop_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_heappop_2); __pyx_t_1 = __Pyx_Import(__pyx_n_s_heapq, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_heappop_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_v_6gevent_6_queue__heappop); __Pyx_DECREF_SET(__pyx_v_6gevent_6_queue__heappop, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+034: from heapq import heapify as _heapify
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_heapify_2); __Pyx_GIVEREF(__pyx_n_s_heapify_2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_heapify_2); __pyx_t_2 = __Pyx_Import(__pyx_n_s_heapq, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_heapify_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_v_6gevent_6_queue__heapify); __Pyx_DECREF_SET(__pyx_v_6gevent_6_queue__heapify, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+035: import collections
__pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
036:
+037: if sys.version_info[0] == 2:
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L2; }
+038: import Queue as __queue__ # python 3: pylint:disable=import-error
__pyx_t_1 = __Pyx_Import(__pyx_n_s_Queue, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_queue_2, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
039: else:
+040: import queue as __queue__ # python 2: pylint:disable=import-error
/*else*/ { __pyx_t_1 = __Pyx_Import(__pyx_n_s_queue, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_queue_2, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L2:;
+041: Full = __queue__.Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_queue_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_Full, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+042: Empty = __queue__.Empty
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_queue_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_Empty, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
043:
+044: from gevent.timeout import Timeout
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Timeout); __Pyx_GIVEREF(__pyx_n_s_Timeout); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Timeout); __pyx_t_2 = __Pyx_Import(__pyx_n_s_gevent_timeout, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timeout, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+045: from gevent._hub_local import get_hub_noargs as get_hub
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_get_hub_noargs); __Pyx_GIVEREF(__pyx_n_s_get_hub_noargs); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_get_hub_noargs); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__hub_local, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_get_hub_noargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hub, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+046: from greenlet import getcurrent
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_getcurrent); __Pyx_GIVEREF(__pyx_n_s_getcurrent); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_getcurrent); __pyx_t_2 = __Pyx_Import(__pyx_n_s_greenlet, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_getcurrent, __pyx_t_1) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+047: from gevent.exceptions import InvalidSwitchError
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_InvalidSwitchError); __Pyx_GIVEREF(__pyx_n_s_InvalidSwitchError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_InvalidSwitchError); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent_exceptions, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_InvalidSwitchError, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
048:
+049: __all__ = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+050: __implements__ = ['Queue', 'PriorityQueue', 'LifoQueue']
__pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Queue); __Pyx_GIVEREF(__pyx_n_s_Queue); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Queue); __Pyx_INCREF(__pyx_n_s_PriorityQueue); __Pyx_GIVEREF(__pyx_n_s_PriorityQueue); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_PriorityQueue); __Pyx_INCREF(__pyx_n_s_LifoQueue); __Pyx_GIVEREF(__pyx_n_s_LifoQueue); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_LifoQueue); if (PyDict_SetItem(__pyx_d, __pyx_n_s_implements, __pyx_t_1) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+051: __extensions__ = ['JoinableQueue', 'Channel']
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_JoinableQueue); __Pyx_GIVEREF(__pyx_n_s_JoinableQueue); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_JoinableQueue); __Pyx_INCREF(__pyx_n_s_Channel); __Pyx_GIVEREF(__pyx_n_s_Channel); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Channel); if (PyDict_SetItem(__pyx_d, __pyx_n_s_extensions, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+052: __imports__ = ['Empty', 'Full']
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Empty); __Pyx_GIVEREF(__pyx_n_s_Empty); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Empty); __Pyx_INCREF(__pyx_n_s_Full); __Pyx_GIVEREF(__pyx_n_s_Full); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Full); if (PyDict_SetItem(__pyx_d, __pyx_n_s_imports, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+053: if hasattr(__queue__, 'SimpleQueue'):
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_queue_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_HasAttr(__pyx_t_1, __pyx_n_s_SimpleQueue); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* … */ }
+054: __all__.append('SimpleQueue') # New in 3.7
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_all); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_n_s_SimpleQueue); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
055: # SimpleQueue is implemented in C and directly allocates locks
056: # unaffected by monkey patching. We need the Python version.
+057: SimpleQueue = __queue__._PySimpleQueue # pylint:disable=no-member
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_queue_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_PySimpleQueue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SimpleQueue, __pyx_t_2) < 0) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+058: __all__ += (__implements__ + __extensions__ + __imports__)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_all); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_implements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_extensions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_imports); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_6) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
059:
060:
061: # pylint 2.0.dev2 things collections.dequeue.popleft() doesn't return
062: # pylint:disable=assignment-from-no-return
063:
+064: def _safe_remove(deq, item):
static PyObject *__pyx_f_6gevent_6_queue__safe_remove(PyObject *__pyx_v_deq, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_safe_remove", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue._safe_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
065: # For when the item may have been removed by
066: # Queue._unlock
+067: 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_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_L8_try_end:; }
+068: deq.remove(item)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_deq, __pyx_n_s_remove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_item); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+069: except ValueError:
__pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError); if (__pyx_t_7) { __Pyx_ErrRestore(0,0,0); goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:;
070: pass
071:
+072: import gevent._waiter
__pyx_t_6 = __Pyx_Import(__pyx_n_s_gevent__waiter, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_gevent, __pyx_t_6) < 0) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+073: locals()['Waiter'] = gevent._waiter.Waiter
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_gevent); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_waiter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Waiter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Globals(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(PyDict_SetItem(__pyx_t_1, __pyx_n_s_Waiter, __pyx_t_6) < 0)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
074:
+075: class ItemWaiter(Waiter): # pylint:disable=undefined-variable
struct __pyx_vtabstruct_6gevent_6_queue_ItemWaiter { struct __pyx_vtabstruct_6gevent_8__waiter_Waiter __pyx_base; }; static struct __pyx_vtabstruct_6gevent_6_queue_ItemWaiter *__pyx_vtabptr_6gevent_6_queue_ItemWaiter;
076: # pylint:disable=assigning-non-slot
077: __slots__ = (
+078: 'item',
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_ItemWaiter->tp_dict, __pyx_n_s_slots, __pyx_tuple__7) < 0) __PYX_ERR(0, 77, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_ItemWaiter); /* … */ __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_item, __pyx_n_s_queue); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7);
079: 'queue',
080: )
081:
+082: def __init__(self, item, queue):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_10ItemWaiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_6_queue_10ItemWaiter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_item = 0; PyObject *__pyx_v_queue = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_item,&__pyx_n_s_queue,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 82, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 82, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_item = values[0]; __pyx_v_queue = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 82, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.ItemWaiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_10ItemWaiter___init__(((struct __pyx_obj_6gevent_6_queue_ItemWaiter *)__pyx_v_self), __pyx_v_item, __pyx_v_queue); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_10ItemWaiter___init__(struct __pyx_obj_6gevent_6_queue_ItemWaiter *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_queue) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.ItemWaiter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+083: Waiter.__init__(self) # pylint:disable=undefined-variable
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+084: 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;
+085: self.queue = queue
__Pyx_INCREF(__pyx_v_queue); __Pyx_GIVEREF(__pyx_v_queue); __Pyx_GOTREF(__pyx_v_self->queue); __Pyx_DECREF(__pyx_v_self->queue); __pyx_v_self->queue = __pyx_v_queue;
086:
+087: def put_and_switch(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_10ItemWaiter_3put_and_switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_10ItemWaiter_2put_and_switch[] = "ItemWaiter.put_and_switch(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_10ItemWaiter_3put_and_switch = {"put_and_switch", (PyCFunction)__pyx_pw_6gevent_6_queue_10ItemWaiter_3put_and_switch, METH_NOARGS, __pyx_doc_6gevent_6_queue_10ItemWaiter_2put_and_switch}; static PyObject *__pyx_pw_6gevent_6_queue_10ItemWaiter_3put_and_switch(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_and_switch (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_10ItemWaiter_2put_and_switch(((struct __pyx_obj_6gevent_6_queue_ItemWaiter *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_10ItemWaiter_2put_and_switch(struct __pyx_obj_6gevent_6_queue_ItemWaiter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_and_switch", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.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_tuple__8 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_10ItemWaiter_3put_and_switch, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_ItemWaiter_put_and_switch, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_ItemWaiter->tp_dict, __pyx_n_s_put_and_switch, __pyx_t_6) < 0) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_ItemWaiter); __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_and_switch, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 87, __pyx_L1_error)
+088: self.queue._put(self.item)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->queue, __pyx_n_s_put); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self->item) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->item); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+089: 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;
+090: 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;
+091: return self.switch(self)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
092:
+093: class Queue(object):
struct __pyx_vtabstruct_6gevent_6_queue_Queue { PyObject *(*_get)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); PyObject *(*_put)(struct __pyx_obj_6gevent_6_queue_Queue *, PyObject *, int __pyx_skip_dispatch); PyObject *(*_peek)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); Py_ssize_t (*qsize)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); int (*empty)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); int (*full)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); PyObject *(*put)(struct __pyx_obj_6gevent_6_queue_Queue *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_put *__pyx_optional_args); PyObject *(*put_nowait)(struct __pyx_obj_6gevent_6_queue_Queue *, PyObject *, int __pyx_skip_dispatch); PyObject *(*__pyx___get_or_peek)(struct __pyx_obj_6gevent_6_queue_Queue *, PyObject *, PyObject *, PyObject *); PyObject *(*get)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_get *__pyx_optional_args); PyObject *(*get_nowait)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); PyObject *(*peek)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_peek *__pyx_optional_args); PyObject *(*peek_nowait)(struct __pyx_obj_6gevent_6_queue_Queue *, int __pyx_skip_dispatch); PyObject *(*_schedule_unlock)(struct __pyx_obj_6gevent_6_queue_Queue *); }; static struct __pyx_vtabstruct_6gevent_6_queue_Queue *__pyx_vtabptr_6gevent_6_queue_Queue;
094: """
095: Create a queue object with a given maximum size.
096:
097: If *maxsize* is less than or equal to zero or ``None``, the queue
098: size is infinite.
099:
100: Queues have a ``len`` equal to the number of items in them (the :meth:`qsize`),
101: but in a boolean context they are always True.
102:
103: .. versionchanged:: 1.1b3
104: Queues now support :func:`len`; it behaves the same as :meth:`qsize`.
105: .. versionchanged:: 1.1b3
106: Multiple greenlets that block on a call to :meth:`put` for a full queue
107: will now be awakened to put their items into the queue in the order in which
108: they arrived. Likewise, multiple greenlets that block on a call to :meth:`get` for
109: an empty queue will now receive items in the order in which they blocked. An
110: implementation quirk under CPython *usually* ensured this was roughly the case
111: previously anyway, but that wasn't the case for PyPy.
112: """
113:
114: __slots__ = (
+115: '_maxsize',
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_slots, __pyx_tuple__10) < 0) __PYX_ERR(0, 114, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); /* … */ __pyx_tuple__10 = PyTuple_Pack(7, __pyx_n_s_maxsize_2, __pyx_n_s_getters, __pyx_n_s_putters, __pyx_n_s_hub, __pyx_n_s_event_unlock, __pyx_n_s_queue, __pyx_n_s_weakref); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10);
116: 'getters',
117: 'putters',
118: 'hub',
119: '_event_unlock',
120: 'queue',
121: '__weakref__',
122: )
123:
+124: def __init__(self, maxsize=None, items=(), _warn_depth=2):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_5Queue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_6_queue_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__warn_depth = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxsize,&__pyx_n_s_items,&__pyx_n_s_warn_depth,0}; PyObject* values[3] = {0,0,0}; values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)__pyx_empty_tuple); values[2] = ((PyObject *)__pyx_int_2); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_warn_depth); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 124, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_maxsize = values[0]; __pyx_v_items = values[1]; __pyx_v__warn_depth = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 124, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Queue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_5Queue___init__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items, __pyx_v__warn_depth); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_5Queue___init__(struct __pyx_obj_6gevent_6_queue_Queue *__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_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF(__pyx_v_maxsize); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue.Queue.__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; }
+125: if maxsize is not None and maxsize <= 0:
__pyx_t_2 = (__pyx_v_maxsize != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = PyObject_RichCompare(__pyx_v_maxsize, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+126: if maxsize == 0:
__pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_maxsize, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { /* … */ }
+127: import warnings
__pyx_t_4 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_warnings = __pyx_t_4; __pyx_t_4 = 0;
+128: warnings.warn(
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_warn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* … */ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple_, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_tuple_ = PyTuple_Pack(2, __pyx_kp_s_Queue_0_now_equivalent_to_Queue, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
129: 'Queue(0) now equivalent to Queue(None); if you want a channel, use Channel',
130: DeprecationWarning,
+131: stacklevel=_warn_depth)
__pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_stacklevel, __pyx_v__warn_depth) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
+132: maxsize = None
__Pyx_INCREF(Py_None); __Pyx_DECREF_SET(__pyx_v_maxsize, Py_None);
133:
+134: self._maxsize = maxsize if maxsize is not None else -1
__pyx_t_1 = (__pyx_v_maxsize != Py_None); if ((__pyx_t_1 != 0)) { __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_maxsize); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_t_7 = __pyx_t_8; } else { __pyx_t_7 = -1L; } __pyx_v_self->_maxsize = __pyx_t_7;
135: # Explicitly maintain order for getters and putters that block
136: # so that callers can consistently rely on getting things out
137: # in the apparent order they went in. This was once required by
138: # imap_unordered. Previously these were set() objects, and the
139: # items put in the set have default hash() and eq() methods;
140: # under CPython, since new objects tend to have increasing
141: # hash values, this tended to roughly maintain order anyway,
142: # but that's not true under PyPy. An alternative to a deque
143: # (to avoid the linear scan of remove()) might be an
144: # OrderedDict, but it's 2.7 only; we don't expect to have so
145: # many waiters that removing an arbitrary element is a
146: # bottleneck, though.
+147: self.getters = collections.deque()
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_collections); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_deque); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->getters); __Pyx_DECREF(__pyx_v_self->getters); __pyx_v_self->getters = __pyx_t_6; __pyx_t_6 = 0;
+148: self.putters = collections.deque()
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_deque); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->putters); __Pyx_DECREF(__pyx_v_self->putters); __pyx_v_self->putters = __pyx_t_6; __pyx_t_6 = 0;
+149: self.hub = get_hub()
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_hub); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->hub); __Pyx_DECREF(__pyx_v_self->hub); __pyx_v_self->hub = __pyx_t_6; __pyx_t_6 = 0;
+150: 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;
+151: self.queue = self._create_queue(items)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_queue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_items) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_items); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->queue); __Pyx_DECREF(__pyx_v_self->queue); __pyx_v_self->queue = __pyx_t_6; __pyx_t_6 = 0;
152:
153: @property
+154: def maxsize(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_7maxsize_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_7maxsize_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_7maxsize___get__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_7maxsize___get__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gevent._queue.Queue.maxsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+155: return self._maxsize if self._maxsize > 0 else None
__Pyx_XDECREF(__pyx_r); if (((__pyx_v_self->_maxsize > 0) != 0)) { __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->_maxsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; } else { __Pyx_INCREF(Py_None); __pyx_t_1 = Py_None; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
156:
157: @maxsize.setter
+158: def maxsize(self, nv):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_5Queue_7maxsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_nv); /*proto*/ static int __pyx_pw_6gevent_6_queue_5Queue_7maxsize_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_nv) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_7maxsize_2__set__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), ((PyObject *)__pyx_v_nv)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_5Queue_7maxsize_2__set__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_nv) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.Queue.maxsize.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
159: # QQQ make maxsize into a property with setter that schedules unlock if necessary
+160: if nv is None or nv <= 0:
__pyx_t_2 = (__pyx_v_nv == Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = PyObject_RichCompare(__pyx_v_nv, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+161: self._maxsize = -1
__pyx_v_self->_maxsize = -1L;
162: else:
+163: self._maxsize = nv
/*else*/ { __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nv); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) __pyx_v_self->_maxsize = __pyx_t_5; } __pyx_L3:;
164:
+165: def copy(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_2copy[] = "Queue.copy(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_3copy = {"copy", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_3copy, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_2copy}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_2copy(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_2copy(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue.Queue.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_copy, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_copy, __pyx_t_6) < 0) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_copy, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 165, __pyx_L1_error)
+166: return type(self)(self.maxsize, self.queue)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maxsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __pyx_t_3 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_v_self->queue}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_v_self->queue}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_v_self->queue); __Pyx_GIVEREF(__pyx_v_self->queue); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_self->queue); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
167:
+168: def _create_queue(self, items=()):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_5_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_4_create_queue[] = "Queue._create_queue(self, items=())"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_5_create_queue = {"_create_queue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_5Queue_5_create_queue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_5Queue_4_create_queue}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_5_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_items = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_empty_tuple); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_queue") < 0)) __PYX_ERR(0, 168, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_items = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 168, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Queue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_4_create_queue(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_items); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_4_create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_items) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.Queue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_items); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_5_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__create_queue, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_create_queue, __pyx_t_6) < 0) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_create_queue, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 168, __pyx_L1_error)
+169: return collections.deque(items)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_items) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_items); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __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;
170:
+171: def _get(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue__get(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_7_get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.Queue._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_6_queue_5Queue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_6_get[] = "Queue._get(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_7_get = {"_get", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_7_get, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_6_get}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_7_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_6_get(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_6_get(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __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._queue.Queue._get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_7_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__get, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_get, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 171, __pyx_L1_error)
+172: return self.queue.popleft()
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->queue, __pyx_n_s_popleft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
173:
+174: def _peek(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_9_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue__peek(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_9_peek)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.Queue._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_6_queue_5Queue_9_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_8_peek[] = "Queue._peek(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_9_peek = {"_peek", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_9_peek, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_8_peek}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_9_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_8_peek(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_8_peek(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue__peek(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __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._queue.Queue._peek", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_9_peek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__peek, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_peek, __pyx_t_6) < 0) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_peek, 174, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 174, __pyx_L1_error)
+175: return self.queue[0]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->queue, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
176:
+177: def _put(self, item):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_11_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue__put(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_11_put)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_5Queue_11_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_10_put[] = "Queue._put(self, item)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_11_put = {"_put", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_11_put, METH_O, __pyx_doc_6gevent_6_queue_5Queue_10_put}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_11_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_10_put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_10_put(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __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._queue.Queue._put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_11_put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_put, __pyx_t_6) < 0) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 177, __pyx_L1_error)
+178: self.queue.append(item)
__pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->queue, __pyx_v_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 178, __pyx_L1_error)
179:
+180: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_13__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_13__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_12__repr__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_12__repr__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._queue.Queue.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+181: 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_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_at_s_s, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
182:
+183: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_15__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_15__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_14__str__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_14__str__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.Queue.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+184: 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_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
185:
+186: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_17_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_16_format[] = "Queue._format(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_17_format = {"_format", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_17_format, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_16_format}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_17_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_16_format(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_16_format(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.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_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_17_format, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__format, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_format, __pyx_t_6) < 0) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_format, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 186, __pyx_L1_error)
+187: result = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+188: if self.maxsize is not None:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __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; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { /* … */ }
+189: result.append('maxsize=%r' % (self.maxsize, ))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_maxsize_r, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+190: if getattr(self, 'queue', None):
__pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_queue, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { /* … */ }
+191: result.append('queue=%r' % (self.queue, ))
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self->queue); __Pyx_GIVEREF(__pyx_v_self->queue); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->queue); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_queue_r, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+192: if self.getters:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 192, __pyx_L1_error) if (__pyx_t_3) { /* … */ }
+193: result.append('getters[%s]' % len(self.getters))
__pyx_t_4 = __pyx_v_self->getters; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_getters_s, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+194: if self.putters:
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 194, __pyx_L1_error) if (__pyx_t_3) { /* … */ }
+195: result.append('putters[%s]' % len(self.putters))
__pyx_t_1 = __pyx_v_self->putters; __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, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_putters_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+196: if result:
__pyx_t_3 = (PyList_GET_SIZE(__pyx_v_result) != 0);
if (__pyx_t_3) {
/* … */
}
+197: return ' ' + ' '.join(result)
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__2, __pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyNumber_Add(__pyx_kp_s__2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+198: return ''
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_kp_s__3); __pyx_r = __pyx_kp_s__3; goto __pyx_L0;
199:
+200: def qsize(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_19qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static Py_ssize_t __pyx_f_6gevent_6_queue_5Queue_qsize(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_qsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_19qsize)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._queue.Queue.qsize", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_19qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_18qsize[] = "Queue.qsize(self) -> Py_ssize_t\nReturn the size of the queue."; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_19qsize = {"qsize", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_19qsize, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_18qsize}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_19qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_18qsize(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_18qsize(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromSsize_t(__pyx_f_6gevent_6_queue_5Queue_qsize(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __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._queue.Queue.qsize", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_19qsize, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_qsize, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_qsize, __pyx_t_6) < 0) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_qsize, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 200, __pyx_L1_error)
201: """Return the size of the queue."""
+202: return len(self.queue)
__pyx_t_1 = __pyx_v_self->queue; __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, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
203:
+204: def __len__(self):
/* Python wrapper */ static Py_ssize_t __pyx_pw_6gevent_6_queue_5Queue_21__len__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_20__len__[] = "\n Return 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.\n "; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_6gevent_6_queue_5Queue_20__len__; #endif static Py_ssize_t __pyx_pw_6gevent_6_queue_5Queue_21__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_20__len__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_6gevent_6_queue_5Queue_20__len__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
205: """
206: Return the size of the queue. This is the same as :meth:`qsize`.
207:
208: .. versionadded: 1.1b3
209:
210: Previously, getting len() of a queue would raise a TypeError.
211: """
212:
+213: return self.qsize()
__pyx_r = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0); goto __pyx_L0;
214:
+215: def __bool__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_5Queue_23__bool__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_6gevent_6_queue_5Queue_23__bool__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_22__bool__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_5Queue_22__bool__(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__bool__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
216: """
217: A queue object is always True.
218:
219: .. versionadded: 1.1b3
220:
221: Now that queues support len(), they need to implement ``__bool__``
222: to return True for backwards compatibility.
223: """
+224: return True
__pyx_r = 1; goto __pyx_L0;
225:
+226: def __nonzero__(self):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_5Queue_25__nonzero__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_6gevent_6_queue_5Queue_25__nonzero__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_24__nonzero__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_5Queue_24__nonzero__(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__nonzero__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
227: # Py2.
228: # For Cython; __bool__ becomes a special method that we can't
229: # get by name.
+230: return True
__pyx_r = 1; goto __pyx_L0;
231:
+232: def empty(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_27empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_6_queue_5Queue_empty(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_27empty)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._queue.Queue.empty", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_27empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_26empty[] = "Queue.empty(self) -> bool\nReturn ``True`` if the queue is empty, ``False`` otherwise."; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_27empty = {"empty", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_27empty, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_26empty}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_27empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_26empty(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_26empty(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_6_queue_5Queue_empty(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __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._queue.Queue.empty", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_27empty, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_empty, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_empty, __pyx_t_6) < 0) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_empty, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 232, __pyx_L1_error)
233: """Return ``True`` if the queue is empty, ``False`` otherwise."""
+234: return not self.qsize()
__pyx_r = (!(((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0)); goto __pyx_L0;
235:
+236: def full(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_29full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_6gevent_6_queue_5Queue_full(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_29full)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("gevent._queue.Queue.full", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_29full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_28full[] = "Queue.full(self) -> bool\nReturn ``True`` if the queue is full, ``False`` otherwise.\n\n ``Queue(None)`` is never full.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_29full = {"full", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_29full, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_28full}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_29full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_28full(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_28full(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_6gevent_6_queue_5Queue_full(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __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._queue.Queue.full", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_29full, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_full, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_full, __pyx_t_6) < 0) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_full, 236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 236, __pyx_L1_error)
237: """Return ``True`` if the queue is full, ``False`` otherwise.
238:
239: ``Queue(None)`` is never full.
240: """
+241: return self._maxsize > 0 and self.qsize() >= self._maxsize
__pyx_t_6 = ((__pyx_v_self->_maxsize > 0) != 0); if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L3_bool_binop_done; } __pyx_t_6 = ((((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) >= __pyx_v_self->_maxsize) != 0); __pyx_t_5 = __pyx_t_6; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_5; goto __pyx_L0;
242:
+243: def put(self, item, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_31put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_put(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_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_6_queue_ItemWaiter *__pyx_v_waiter = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_block = __pyx_optional_args->block; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_timeout = __pyx_optional_args->timeout; } } } __Pyx_INCREF(__pyx_v_timeout); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_31put)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_item, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_item, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_item); __Pyx_INCREF(__pyx_v_block); __Pyx_GIVEREF(__pyx_v_block); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_block); __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_timeout); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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_6); __Pyx_AddTraceback("gevent._queue.Queue.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_6_queue_5Queue_31put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_30put[] = "Queue.put(self, item, block=True, timeout=None)\nPut an item into the queue.\n\n If optional arg *block* is true and *timeout* is ``None`` (the default),\n block if necessary until a free slot is available. If *timeout* is\n a positive number, it blocks at most *timeout* seconds and raises\n the :class:`Full` exception if no free slot was available within that time.\n Otherwise (*block* is false), put an item on the queue if a free slot\n is immediately available, else raise the :class:`Full` exception (*timeout*\n is ignored in that case).\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_31put = {"put", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_5Queue_31put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_5Queue_30put}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_31put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_item = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_item,&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[3] = {0,0,0}; values[1] = ((PyObject *)Py_True); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) __PYX_ERR(0, 243, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_item = values[0]; __pyx_v_block = values[1]; __pyx_v_timeout = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 243, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Queue.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_30put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_30put(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_6_queue_Queue->put(__pyx_v_self, __pyx_v_item, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __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._queue.Queue.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_item, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_31put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_put_2, __pyx_t_6) < 0) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_2, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 243, __pyx_L1_error)
244: """Put an item into the queue.
245:
246: If optional arg *block* is true and *timeout* is ``None`` (the default),
247: block if necessary until a free slot is available. If *timeout* is
248: a positive number, it blocks at most *timeout* seconds and raises
249: the :class:`Full` exception if no free slot was available within that time.
250: Otherwise (*block* is false), put an item on the queue if a free slot
251: is immediately available, else raise the :class:`Full` exception (*timeout*
252: is ignored in that case).
253: """
+254: if self._maxsize == -1 or self.qsize() < self._maxsize:
__pyx_t_8 = ((__pyx_v_self->_maxsize == -1L) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L4_bool_binop_done; } __pyx_t_8 = ((((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) < __pyx_v_self->_maxsize) != 0); __pyx_t_7 = __pyx_t_8; __pyx_L4_bool_binop_done:; if (__pyx_t_7) { /* … */ goto __pyx_L3; }
255: # there's a free slot, put an item right away
+256: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+257: if self.getters:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+258: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+259: elif self.hub is getcurrent():
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ }
260: # We're in the mainloop, so we cannot wait; we can switch to other greenlets though.
261: # Check if possible to get a free slot in the queue.
+262: 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, 262, __pyx_L1_error) if (__pyx_t_7) { } else { __pyx_t_8 = __pyx_t_7; goto __pyx_L9_bool_binop_done; } __pyx_t_7 = (((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0); if (__pyx_t_7) { } else { __pyx_t_8 = __pyx_t_7; goto __pyx_L9_bool_binop_done; } __pyx_t_7 = ((((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) >= __pyx_v_self->_maxsize) != 0); __pyx_t_8 = __pyx_t_7; __pyx_L9_bool_binop_done:; if (!__pyx_t_8) break;
+263: getter = self.getters.popleft()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->getters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_1); __pyx_t_1 = 0;
+264: getter.switch(getter)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_getter, __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_getter) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_getter); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; }
+265: if self.qsize() < self._maxsize:
__pyx_t_8 = ((((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) < __pyx_v_self->_maxsize) != 0); if (__pyx_t_8) { /* … */ }
+266: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+267: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+268: raise Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __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, 268, __pyx_L1_error)
+269: elif block:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 269, __pyx_L1_error) if (likely(__pyx_t_8)) { /* … */ goto __pyx_L3; }
+270: waiter = ItemWaiter(item, self)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_item); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6gevent_6_queue_ItemWaiter), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_waiter = ((struct __pyx_obj_6gevent_6_queue_ItemWaiter *)__pyx_t_2); __pyx_t_2 = 0;
+271: 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, 271, __pyx_L1_error)
+272: timeout = Timeout._start_new_or_dummy(timeout, Full)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_timeout, __pyx_t_1}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_timeout, __pyx_t_1}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_timeout); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_2); __pyx_t_2 = 0;
+273: try:
/*try:*/ {
+274: if self.getters:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 274, __pyx_L14_error) if (__pyx_t_8) { /* … */ }
+275: self._schedule_unlock()
__pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+276: result = waiter.get()
__pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_ItemWaiter *)__pyx_v_waiter->__pyx_base.__pyx_vtab)->__pyx_base.get(((struct __pyx_obj_6gevent_8__waiter_Waiter *)__pyx_v_waiter), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0;
+277: if result is not waiter:
__pyx_t_8 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter)); __pyx_t_7 = (__pyx_t_8 != 0); if (unlikely(__pyx_t_7)) { /* … */ } }
+278: raise InvalidSwitchError("Invalid switch into Queue.put: %r" % (result, ))
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_result); __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Queue_put_r, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 278, __pyx_L14_error)
279: finally:
+280: timeout.cancel()
/*finally:*/ { /*normal exit:*/{ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L19_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L19_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+281: _safe_remove(self.putters, waiter)
__pyx_t_2 = __pyx_v_self->putters; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_f_6gevent_6_queue__safe_remove(__pyx_t_2, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L15; } __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __pyx_t_5 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; { /* … */ __pyx_t_3 = __pyx_v_self->putters; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_f_6gevent_6_queue__safe_remove(__pyx_t_3, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 281, __pyx_L19_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; goto __pyx_L1_error; __pyx_L19_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; goto __pyx_L1_error; } __pyx_L15:; }
282: else:
+283: raise Full
/*else*/ { __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __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, 283, __pyx_L1_error) } __pyx_L3:;
284:
+285: def put_nowait(self, item):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_33put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_put_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_33put_nowait)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.Queue.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_6_queue_5Queue_33put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_32put_nowait[] = "Queue.put_nowait(self, item)\nPut an item into the queue without blocking.\n\n Only enqueue the item if a free slot is immediately available.\n Otherwise raise the :class:`Full` exception.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_33put_nowait = {"put_nowait", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_33put_nowait, METH_O, __pyx_doc_6gevent_6_queue_5Queue_32put_nowait}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_33put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_32put_nowait(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_32put_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue_put_nowait(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __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._queue.Queue.put_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_33put_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_put_nowait, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_put_nowait, __pyx_t_6) < 0) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_nowait, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 285, __pyx_L1_error)
286: """Put an item into the queue without blocking.
287:
288: Only enqueue the item if a free slot is immediately available.
289: Otherwise raise the :class:`Full` exception.
290: """
+291: self.put(item, False)
__pyx_t_5.__pyx_n = 1; __pyx_t_5.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->put(__pyx_v_self, __pyx_v_item, 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
292:
+293: def __get_or_peek(self, method, block, timeout):
static PyObject *__pyx_f_6gevent_6_queue_5Queue___get_or_peek(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { struct __pyx_obj_6gevent_8__waiter_Waiter *__pyx_v_waiter = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get_or_peek", 0); __Pyx_INCREF(__pyx_v_timeout); /* … */ /* 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_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("gevent._queue.Queue.__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; }
294: # Internal helper method. The `method` should be either
295: # self._get when called from self.get() or self._peek when
296: # called from self.peek(). Call this after the initial check
297: # to see if there are items in the queue.
298:
+299: if self.hub is getcurrent():
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { /* … */ }
300: # special case to make get_nowait() or peek_nowait() runnable in the mainloop greenlet
301: # there are no items in the queue; try to fix the situation by unlocking putters
+302: while self.putters:
while (1) { __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 302, __pyx_L1_error) if (!__pyx_t_5) break;
303: # Note: get() used popleft(), peek used pop(); popleft
304: # is almost certainly correct.
+305: self.putters.popleft().put_and_switch()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->putters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_put_and_switch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+306: if self.qsize():
__pyx_t_5 = (((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0); if (__pyx_t_5) { /* … */ } }
+307: return method()
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_method); __pyx_t_3 = __pyx_v_method; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __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;
+308: raise Empty()
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 308, __pyx_L1_error)
309:
+310: if not block:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 310, __pyx_L1_error) __pyx_t_4 = ((!__pyx_t_5) != 0); if (unlikely(__pyx_t_4)) { /* … */ }
311: # We can't block, we're not the hub, and we have nothing
312: # to return. No choice...
+313: raise Empty()
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 313, __pyx_L1_error)
314:
+315: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_waiter = ((struct __pyx_obj_6gevent_8__waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+316: timeout = Timeout._start_new_or_dummy(timeout, Empty)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_timeout, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_timeout, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_timeout); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+317: try:
/*try:*/ {
+318: 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, 318, __pyx_L9_error)
+319: if self.putters:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 319, __pyx_L9_error) if (__pyx_t_4) { /* … */ }
+320: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+321: result = waiter.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_8__waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+322: if result is not waiter:
__pyx_t_4 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter)); __pyx_t_5 = (__pyx_t_4 != 0); if (unlikely(__pyx_t_5)) { /* … */ }
+323: raise InvalidSwitchError('Invalid switch into Queue.get: %r' % (result, ))
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 323, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_result); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Queue_get_r, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 323, __pyx_L9_error)
+324: return method()
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_method); __pyx_t_2 = __pyx_v_method; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L8_return; }
325: finally:
+326: timeout.cancel()
/*finally:*/ { __pyx_L9_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __pyx_t_7 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L14_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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __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;
+327: _safe_remove(self.getters, waiter)
__pyx_t_1 = __pyx_v_self->getters; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_f_6gevent_6_queue__safe_remove(__pyx_t_1, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; goto __pyx_L1_error; __pyx_L14_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; goto __pyx_L1_error; } __pyx_L8_return: { __pyx_t_17 = __pyx_r; __pyx_r = 0; /* … */ __pyx_t_2 = __pyx_v_self->getters; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __pyx_f_6gevent_6_queue__safe_remove(__pyx_t_2, ((PyObject *)__pyx_v_waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_17; __pyx_t_17 = 0; goto __pyx_L0; } }
328:
+329: def get(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_35get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_get(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_get *__pyx_optional_args) { PyObject *__pyx_v_block = ((PyObject *)Py_True); PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_block = __pyx_optional_args->block; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_timeout = __pyx_optional_args->timeout; } } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_35get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_block); __Pyx_GIVEREF(__pyx_v_block); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_block); __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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_6); __Pyx_AddTraceback("gevent._queue.Queue.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_6_queue_5Queue_35get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_34get[] = "Queue.get(self, block=True, timeout=None)\nRemove and return an item from the queue.\n\n If optional args *block* is true and *timeout* is ``None`` (the default),\n block if necessary until an item is available. If *timeout* is a positive number,\n it blocks at most *timeout* seconds and raises the :class:`Empty` exception\n if no item was available within that time. Otherwise (*block* is false), return\n an item if one is immediately available, else raise the :class:`Empty` exception\n (*timeout* is ignored in that case).\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_35get = {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_5Queue_35get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_5Queue_34get}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_35get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_True); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 329, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_block = values[0]; __pyx_v_timeout = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 329, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Queue.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_34get(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_34get(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_6_queue_Queue->get(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __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._queue.Queue.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_35get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_get, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_get_2, __pyx_t_6) < 0) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get_2, 329, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 329, __pyx_L1_error)
330: """Remove and return an item from the queue.
331:
332: If optional args *block* is true and *timeout* is ``None`` (the default),
333: block if necessary until an item is available. If *timeout* is a positive number,
334: it blocks at most *timeout* seconds and raises the :class:`Empty` exception
335: if no item was available within that time. Otherwise (*block* is false), return
336: an item if one is immediately available, else raise the :class:`Empty` exception
337: (*timeout* is ignored in that case).
338: """
+339: if self.qsize():
__pyx_t_7 = (((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0); if (__pyx_t_7) { /* … */ }
+340: if self.putters:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 340, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+341: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+342: return self._get()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_get(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
343:
+344: return self.__get_or_peek(self._get, block, timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->__pyx___get_or_peek(__pyx_v_self, __pyx_t_1, __pyx_v_block, __pyx_v_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __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;
345:
+346: def get_nowait(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_37get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_get_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_37get_nowait)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.Queue.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_6_queue_5Queue_37get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_36get_nowait[] = "Queue.get_nowait(self)\nRemove and return an item from the queue without blocking.\n\n Only get an item if one is immediately available. Otherwise\n raise the :class:`Empty` exception.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_37get_nowait = {"get_nowait", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_37get_nowait, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_36get_nowait}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_37get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_36get_nowait(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_36get_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue_get_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __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._queue.Queue.get_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_37get_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_get_nowait, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_get_nowait, __pyx_t_6) < 0) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get_nowait, 346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 346, __pyx_L1_error)
347: """Remove and return an item from the queue without blocking.
348:
349: Only get an item if one is immediately available. Otherwise
350: raise the :class:`Empty` exception.
351: """
+352: return self.get(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_5.__pyx_n = 1; __pyx_t_5.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
353:
+354: def peek(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_39peek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_peek(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_5Queue_peek *__pyx_optional_args) { PyObject *__pyx_v_block = ((PyObject *)Py_True); PyObject *__pyx_v_timeout = ((PyObject *)Py_None); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_block = __pyx_optional_args->block; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_timeout = __pyx_optional_args->timeout; } } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_peek_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_39peek)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_block); __Pyx_GIVEREF(__pyx_v_block); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_block); __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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_6); __Pyx_AddTraceback("gevent._queue.Queue.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_6_queue_5Queue_39peek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_38peek[] = "Queue.peek(self, block=True, timeout=None)\nReturn an item from the queue without removing it.\n\n If optional args *block* is true and *timeout* is ``None`` (the default),\n block if necessary until an item is available. If *timeout* is a positive number,\n it blocks at most *timeout* seconds and raises the :class:`Empty` exception\n if no item was available within that time. Otherwise (*block* is false), return\n an item if one is immediately available, else raise the :class:`Empty` exception\n (*timeout* is ignored in that case).\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_39peek = {"peek", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_5Queue_39peek, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_5Queue_38peek}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_39peek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_True); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "peek") < 0)) __PYX_ERR(0, 354, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_block = values[0]; __pyx_v_timeout = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("peek", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 354, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Queue.peek", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_38peek(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_38peek(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_6_queue_Queue->peek(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __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._queue.Queue.peek", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_39peek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_peek, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_peek_2, __pyx_t_6) < 0) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_peek_2, 354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 354, __pyx_L1_error)
355: """Return an item from the queue without removing it.
356:
357: If optional args *block* is true and *timeout* is ``None`` (the default),
358: block if necessary until an item is available. If *timeout* is a positive number,
359: it blocks at most *timeout* seconds and raises the :class:`Empty` exception
360: if no item was available within that time. Otherwise (*block* is false), return
361: an item if one is immediately available, else raise the :class:`Empty` exception
362: (*timeout* is ignored in that case).
363: """
+364: if self.qsize():
__pyx_t_7 = (((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0); if (__pyx_t_7) { /* … */ }
365: # XXX: Why doesn't this schedule an unlock like get() does?
+366: return self._peek()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_peek(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
367:
+368: return self.__get_or_peek(self._peek, block, timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->__pyx___get_or_peek(__pyx_v_self, __pyx_t_1, __pyx_v_block, __pyx_v_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __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;
369:
+370: def peek_nowait(self):
static PyObject *__pyx_pw_6gevent_6_queue_5Queue_41peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_5Queue_peek_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek_nowait", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_peek_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_5Queue_41peek_nowait)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.Queue.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_6_queue_5Queue_41peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_40peek_nowait[] = "Queue.peek_nowait(self)\nReturn an item from the queue without blocking.\n\n Only return an item if one is immediately available. Otherwise\n raise the :class:`Empty` exception.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_41peek_nowait = {"peek_nowait", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_41peek_nowait, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_40peek_nowait}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_41peek_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_40peek_nowait(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_40peek_nowait(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("peek_nowait", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue_peek_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __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._queue.Queue.peek_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_41peek_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue_peek_nowait, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_peek_nowait, __pyx_t_6) < 0) __PYX_ERR(0, 370, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_peek_nowait, 370, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 370, __pyx_L1_error)
371: """Return an item from the queue without blocking.
372:
373: Only return an item if one is immediately available. Otherwise
374: raise the :class:`Empty` exception.
375: """
+376: return self.peek(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_5.__pyx_n = 1; __pyx_t_5.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->peek(__pyx_v_self, 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
377:
+378: def _unlock(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_43_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_5Queue_42_unlock[] = "Queue._unlock(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_5Queue_43_unlock = {"_unlock", (PyCFunction)__pyx_pw_6gevent_6_queue_5Queue_43_unlock, METH_NOARGS, __pyx_doc_6gevent_6_queue_5Queue_42_unlock}; static PyObject *__pyx_pw_6gevent_6_queue_5Queue_43_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_42_unlock(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_42_unlock(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { int __pyx_v_repeat; PyObject *__pyx_v_putter = NULL; PyObject *__pyx_v_getter = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("gevent._queue.Queue._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_tuple__41 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_repeat, __pyx_n_s_putter, __pyx_n_s_getter); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_5Queue_43_unlock, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Queue__unlock, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_unlock, __pyx_t_6) < 0) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue); __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_unlock, 378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 378, __pyx_L1_error)
+379: while True:
while (1) {
+380: repeat = False
__pyx_v_repeat = 0;
+381: 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, 381, __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) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L6_bool_binop_done; } __pyx_t_2 = ((((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) < __pyx_v_self->_maxsize) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L6_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+382: repeat = True
__pyx_v_repeat = 1;
+383: try:
{ /*try:*/ { /* … */ } /* … */ __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; __pyx_L10_exception_handled:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); __pyx_L16_try_end:; }
+384: putter = self.putters.popleft()
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->putters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 384, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF_SET(__pyx_v_putter, __pyx_t_6); __pyx_t_6 = 0;
+385: self._put(putter.item)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_n_s_item); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 385, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_t_6, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 385, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+386: except: # pylint:disable=bare-except
/*except:*/ { __Pyx_AddTraceback("gevent._queue.Queue._unlock", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 386, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_8);
+387: putter.throw(*sys.exc_info())
if (unlikely(!__pyx_v_putter)) { __Pyx_RaiseUnboundLocalError("putter"); __PYX_ERR(0, 387, __pyx_L11_except_error) } __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_n_s_throw); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_sys); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PySequence_Tuple(__pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 387, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L10_exception_handled; } __pyx_L11_except_error:;
388: else:
+389: putter.switch(putter)
/*else:*/ { __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_n_s_switch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 389, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_v_putter) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_putter); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 389, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L16_try_end; __pyx_L9_error:; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+390: 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, 390, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L20_bool_binop_done; } __pyx_t_2 = (((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->qsize(__pyx_v_self, 0) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L20_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+391: repeat = True
__pyx_v_repeat = 1;
+392: getter = self.getters.popleft()
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->getters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_8); __pyx_t_8 = 0;
+393: getter.switch(getter)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_getter, __pyx_n_s_switch); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_getter) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_getter); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+394: if not repeat:
__pyx_t_1 = ((!(__pyx_v_repeat != 0)) != 0); if (__pyx_t_1) { /* … */ } }
+395: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
396:
+397: def _schedule_unlock(self):
static PyObject *__pyx_f_6gevent_6_queue_5Queue__schedule_unlock(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_schedule_unlock", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue.Queue._schedule_unlock", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+398: 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, 398, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { /* … */ }
+399: self._event_unlock = self.hub.loop.run_callback(self._unlock)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_n_s_loop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlock); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __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;
400:
+401: def __iter__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_45__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_45__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_44__iter__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_44__iter__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+402: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
403:
+404: def __next__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_47__next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_5Queue_47__next__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_5Queue_46__next__(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_5Queue_46__next__(struct __pyx_obj_6gevent_6_queue_Queue *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._queue.Queue.__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; }
+405: result = self.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Queue *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+406: if result is StopIteration:
__pyx_t_2 = (__pyx_v_result == __pyx_builtin_StopIteration); __pyx_t_3 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+407: raise result
__Pyx_Raise(__pyx_v_result, 0, 0, 0); __PYX_ERR(0, 407, __pyx_L1_error)
+408: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
409:
+410: next = __next__ # Py2
__Pyx_GetNameInClass(__pyx_t_6, (PyObject *)__pyx_ptype_6gevent_6_queue_Queue, __pyx_n_s_next); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Queue->tp_dict, __pyx_n_s_next_2, __pyx_t_6) < 0) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Queue);
411:
412:
+413: class UnboundQueue(Queue):
struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue { struct __pyx_vtabstruct_6gevent_6_queue_Queue __pyx_base; }; static struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *__pyx_vtabptr_6gevent_6_queue_UnboundQueue;
414: # A specialization of Queue that knows it can never
415: # be bound. Changing its maxsize has no effect.
416:
+417: __slots__ = ()
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_UnboundQueue->tp_dict, __pyx_n_s_slots, __pyx_empty_tuple) < 0) __PYX_ERR(0, 417, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_UnboundQueue);
418:
+419: def __init__(self, maxsize=None, items=()):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_12UnboundQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_6_queue_12UnboundQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_maxsize = 0; PyObject *__pyx_v_items = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxsize,&__pyx_n_s_items,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)__pyx_empty_tuple); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 419, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_maxsize = values[0]; __pyx_v_items = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 419, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.UnboundQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_12UnboundQueue___init__(((struct __pyx_obj_6gevent_6_queue_UnboundQueue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_12UnboundQueue___init__(struct __pyx_obj_6gevent_6_queue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._queue.UnboundQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+420: if maxsize is not None:
__pyx_t_1 = (__pyx_v_maxsize != Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+421: raise ValueError("UnboundQueue has no maxsize")
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 421, __pyx_L1_error) /* … */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_UnboundQueue_has_no_maxsize); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4);
+422: Queue.__init__(self, maxsize, items)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_queue_Queue), __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else #endif { __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_maxsize); __Pyx_GIVEREF(__pyx_v_maxsize); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_maxsize); __Pyx_INCREF(__pyx_v_items); __Pyx_GIVEREF(__pyx_v_items); PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_items); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+423: self.putters = None # Will never be used.
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->__pyx_base.putters); __Pyx_DECREF(__pyx_v_self->__pyx_base.putters); __pyx_v_self->__pyx_base.putters = Py_None;
424:
+425: def put(self, item, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_6_queue_12UnboundQueue_3put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_12UnboundQueue_put(struct __pyx_obj_6gevent_6_queue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_item, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_12UnboundQueue_put *__pyx_optional_args) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put", 0); if (__pyx_optional_args) { } /* … */ /* 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._queue.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_6_queue_12UnboundQueue_3put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_12UnboundQueue_2put[] = "UnboundQueue.put(self, item, block=True, timeout=None)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_12UnboundQueue_3put = {"put", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_12UnboundQueue_3put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_12UnboundQueue_2put}; static PyObject *__pyx_pw_6gevent_6_queue_12UnboundQueue_3put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_item = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_item,&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[3] = {0,0,0}; values[1] = ((PyObject *)Py_True); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) __PYX_ERR(0, 425, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_item = values[0]; __pyx_v_block = values[1]; __pyx_v_timeout = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 425, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.UnboundQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_12UnboundQueue_2put(((struct __pyx_obj_6gevent_6_queue_UnboundQueue *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_12UnboundQueue_2put(struct __pyx_obj_6gevent_6_queue_UnboundQueue *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_6_queue_UnboundQueue->__pyx_base.put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_item, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __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._queue.UnboundQueue.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_item, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_12UnboundQueue_3put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_UnboundQueue_put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_UnboundQueue->tp_dict, __pyx_n_s_put_2, __pyx_t_6) < 0) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_UnboundQueue); __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_2, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 425, __pyx_L1_error) /* … */ struct __pyx_opt_args_6gevent_6_queue_12UnboundQueue_put { int __pyx_n; PyObject *block; PyObject *timeout; };
+426: self._put(item)
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_item, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+427: if self.getters:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->__pyx_base.getters); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 427, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+428: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_UnboundQueue *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._schedule_unlock(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
429:
430:
+431: class PriorityQueue(Queue):
struct __pyx_vtabstruct_6gevent_6_queue_PriorityQueue { struct __pyx_vtabstruct_6gevent_6_queue_Queue __pyx_base; }; static struct __pyx_vtabstruct_6gevent_6_queue_PriorityQueue *__pyx_vtabptr_6gevent_6_queue_PriorityQueue;
432: '''A subclass of :class:`Queue` that retrieves entries in priority order (lowest first).
433:
434: Entries are typically tuples of the form: ``(priority number, data)``.
435:
436: .. versionchanged:: 1.2a1
437: Any *items* given to the constructor will now be passed through
438: :func:`heapq.heapify` to ensure the invariants of this class hold.
439: Previously it was just assumed that they were already a heap.
440: '''
441:
+442: __slots__ = ()
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_PriorityQueue->tp_dict, __pyx_n_s_slots, __pyx_empty_tuple) < 0) __PYX_ERR(0, 442, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_PriorityQueue);
443:
+444: def _create_queue(self, items=()):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_1_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_13PriorityQueue__create_queue[] = "PriorityQueue._create_queue(self, items=())"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13PriorityQueue_1_create_queue = {"_create_queue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_13PriorityQueue_1_create_queue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_13PriorityQueue__create_queue}; static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_1_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_items = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_empty_tuple); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_queue") < 0)) __PYX_ERR(0, 444, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_items = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 444, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.PriorityQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_13PriorityQueue__create_queue(((struct __pyx_obj_6gevent_6_queue_PriorityQueue *)__pyx_v_self), __pyx_v_items); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13PriorityQueue__create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_items) { PyObject *__pyx_v_q = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.PriorityQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_q); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__45 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_items, __pyx_n_s_q); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13PriorityQueue_1_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PriorityQueue__create_queue, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_PriorityQueue->tp_dict, __pyx_n_s_create_queue, __pyx_t_6) < 0) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_PriorityQueue); __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_create_queue, 444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 444, __pyx_L1_error)
+445: q = list(items)
__pyx_t_1 = PySequence_List(__pyx_v_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_q = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+446: _heapify(q)
__Pyx_INCREF(__pyx_v_6gevent_6_queue__heapify); __pyx_t_2 = __pyx_v_6gevent_6_queue__heapify; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_q) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_q); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+447: return q
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_q); __pyx_r = __pyx_v_q; goto __pyx_L0;
448:
+449: def _put(self, item):
static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_13PriorityQueue__put(struct __pyx_obj_6gevent_6_queue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_13PriorityQueue_3_put)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item); __Pyx_XDECREF(__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_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_13PriorityQueue_2_put[] = "PriorityQueue._put(self, item)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13PriorityQueue_3_put = {"_put", (PyCFunction)__pyx_pw_6gevent_6_queue_13PriorityQueue_3_put, METH_O, __pyx_doc_6gevent_6_queue_13PriorityQueue_2_put}; static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13PriorityQueue_2_put(((struct __pyx_obj_6gevent_6_queue_PriorityQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13PriorityQueue_2_put(struct __pyx_obj_6gevent_6_queue_PriorityQueue *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_13PriorityQueue__put(__pyx_v_self, __pyx_v_item, 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._queue.PriorityQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13PriorityQueue_3_put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PriorityQueue__put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_PriorityQueue->tp_dict, __pyx_n_s_put, __pyx_t_6) < 0) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_PriorityQueue); __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 449, __pyx_L1_error)
+450: _heappush(self.queue, item)
__Pyx_INCREF(__pyx_v_6gevent_6_queue__heappush); __pyx_t_2 = __pyx_v_6gevent_6_queue__heappush; __pyx_t_3 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->__pyx_base.queue, __pyx_v_item}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_self->__pyx_base.queue, __pyx_v_item}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_self->__pyx_base.queue); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.queue); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_self->__pyx_base.queue); __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_item); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
451:
+452: def _get(self):
static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_13PriorityQueue__get(struct __pyx_obj_6gevent_6_queue_PriorityQueue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_13PriorityQueue_5_get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_13PriorityQueue_4_get[] = "PriorityQueue._get(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13PriorityQueue_5_get = {"_get", (PyCFunction)__pyx_pw_6gevent_6_queue_13PriorityQueue_5_get, METH_NOARGS, __pyx_doc_6gevent_6_queue_13PriorityQueue_4_get}; static PyObject *__pyx_pw_6gevent_6_queue_13PriorityQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13PriorityQueue_4_get(((struct __pyx_obj_6gevent_6_queue_PriorityQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13PriorityQueue_4_get(struct __pyx_obj_6gevent_6_queue_PriorityQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_13PriorityQueue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __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._queue.PriorityQueue._get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13PriorityQueue_5_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_PriorityQueue__get, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_PriorityQueue->tp_dict, __pyx_n_s_get, __pyx_t_6) < 0) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_PriorityQueue); __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 452, __pyx_L1_error)
+453: return _heappop(self.queue)
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_6gevent_6_queue__heappop); __pyx_t_2 = __pyx_v_6gevent_6_queue__heappop; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self->__pyx_base.queue) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx_base.queue); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
454:
455:
+456: class LifoQueue(Queue):
struct __pyx_vtabstruct_6gevent_6_queue_LifoQueue { struct __pyx_vtabstruct_6gevent_6_queue_Queue __pyx_base; }; static struct __pyx_vtabstruct_6gevent_6_queue_LifoQueue *__pyx_vtabptr_6gevent_6_queue_LifoQueue;
457: '''A subclass of :class:`Queue` that retrieves most recently added entries first.'''
458:
+459: __slots__ = ()
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_LifoQueue->tp_dict, __pyx_n_s_slots, __pyx_empty_tuple) < 0) __PYX_ERR(0, 459, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_LifoQueue);
460:
+461: def _create_queue(self, items=()):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_1_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_9LifoQueue__create_queue[] = "LifoQueue._create_queue(self, items=())"; static PyMethodDef __pyx_mdef_6gevent_6_queue_9LifoQueue_1_create_queue = {"_create_queue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_9LifoQueue_1_create_queue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_9LifoQueue__create_queue}; static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_1_create_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_items = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_items,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_empty_tuple); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_queue") < 0)) __PYX_ERR(0, 461, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_items = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_create_queue", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 461, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.LifoQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_9LifoQueue__create_queue(((struct __pyx_obj_6gevent_6_queue_LifoQueue *)__pyx_v_self), __pyx_v_items); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_9LifoQueue__create_queue(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_items) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_create_queue", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._queue.LifoQueue._create_queue", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_items); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__51); __Pyx_GIVEREF(__pyx_tuple__51); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_9LifoQueue_1_create_queue, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LifoQueue__create_queue, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_LifoQueue->tp_dict, __pyx_n_s_create_queue, __pyx_t_6) < 0) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_LifoQueue); __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_create_queue, 461, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 461, __pyx_L1_error)
+462: return list(items)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PySequence_List(__pyx_v_items); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
463:
+464: def _put(self, item):
static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_9LifoQueue__put(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_9LifoQueue_3_put)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_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 tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_9LifoQueue_2_put[] = "LifoQueue._put(self, item)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_9LifoQueue_3_put = {"_put", (PyCFunction)__pyx_pw_6gevent_6_queue_9LifoQueue_3_put, METH_O, __pyx_doc_6gevent_6_queue_9LifoQueue_2_put}; static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_3_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_9LifoQueue_2_put(((struct __pyx_obj_6gevent_6_queue_LifoQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_9LifoQueue_2_put(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_9LifoQueue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._queue.LifoQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_9LifoQueue_3_put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LifoQueue__put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_LifoQueue->tp_dict, __pyx_n_s_put, __pyx_t_6) < 0) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_LifoQueue); __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put, 464, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 464, __pyx_L1_error)
+465: self.queue.append(item)
__pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_self->__pyx_base.queue, __pyx_v_item); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 465, __pyx_L1_error)
466:
+467: def _get(self):
static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_9LifoQueue__get(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_9LifoQueue_5_get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_9LifoQueue_4_get[] = "LifoQueue._get(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_9LifoQueue_5_get = {"_get", (PyCFunction)__pyx_pw_6gevent_6_queue_9LifoQueue_5_get, METH_NOARGS, __pyx_doc_6gevent_6_queue_9LifoQueue_4_get}; static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_5_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_9LifoQueue_4_get(((struct __pyx_obj_6gevent_6_queue_LifoQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_9LifoQueue_4_get(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_9LifoQueue__get(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __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._queue.LifoQueue._get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_9LifoQueue_5_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LifoQueue__get, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_LifoQueue->tp_dict, __pyx_n_s_get, __pyx_t_6) < 0) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_LifoQueue); __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 467, __pyx_L1_error)
+468: return self.queue.pop()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_Pop(__pyx_v_self->__pyx_base.queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
469:
+470: def _peek(self):
static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_9LifoQueue__peek(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_peek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_9LifoQueue_7_peek)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_9LifoQueue_6_peek[] = "LifoQueue._peek(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_9LifoQueue_7_peek = {"_peek", (PyCFunction)__pyx_pw_6gevent_6_queue_9LifoQueue_7_peek, METH_NOARGS, __pyx_doc_6gevent_6_queue_9LifoQueue_6_peek}; static PyObject *__pyx_pw_6gevent_6_queue_9LifoQueue_7_peek(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_9LifoQueue_6_peek(((struct __pyx_obj_6gevent_6_queue_LifoQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_9LifoQueue_6_peek(struct __pyx_obj_6gevent_6_queue_LifoQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_peek", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_9LifoQueue__peek(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __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._queue.LifoQueue._peek", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__57); __Pyx_GIVEREF(__pyx_tuple__57); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_9LifoQueue_7_peek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_LifoQueue__peek, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_LifoQueue->tp_dict, __pyx_n_s_peek, __pyx_t_6) < 0) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_LifoQueue); __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_peek, 470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 470, __pyx_L1_error)
+471: return self.queue[-1]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->__pyx_base.queue, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
472:
473:
+474: class JoinableQueue(Queue):
struct __pyx_vtabstruct_6gevent_6_queue_JoinableQueue { struct __pyx_vtabstruct_6gevent_6_queue_Queue __pyx_base; }; static struct __pyx_vtabstruct_6gevent_6_queue_JoinableQueue *__pyx_vtabptr_6gevent_6_queue_JoinableQueue;
475: """
476: A subclass of :class:`Queue` that additionally has
477: :meth:`task_done` and :meth:`join` methods.
478: """
479:
480: __slots__ = (
+481: '_cond',
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_slots, __pyx_tuple__59) < 0) __PYX_ERR(0, 480, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); /* … */ __pyx_tuple__59 = PyTuple_Pack(2, __pyx_n_s_cond, __pyx_n_s_unfinished_tasks); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__59); __Pyx_GIVEREF(__pyx_tuple__59);
482: 'unfinished_tasks',
483: )
484:
+485: def __init__(self, maxsize=None, items=(), unfinished_tasks=None):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_13JoinableQueue_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue___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_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_6gevent_6_queue_13JoinableQueue___init__; #endif static int __pyx_pw_6gevent_6_queue_13JoinableQueue_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; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxsize,&__pyx_n_s_items,&__pyx_n_s_unfinished_tasks,0}; PyObject* values[3] = {0,0,0}; values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)__pyx_empty_tuple); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_items); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unfinished_tasks); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 485, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_maxsize = values[0]; __pyx_v_items = values[1]; __pyx_v_unfinished_tasks = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 485, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.JoinableQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue___init__(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self), __pyx_v_maxsize, __pyx_v_items, __pyx_v_unfinished_tasks); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_13JoinableQueue___init__(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self, PyObject *__pyx_v_maxsize, PyObject *__pyx_v_items, PyObject *__pyx_v_unfinished_tasks) { PyObject *__pyx_v_Event = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.JoinableQueue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_Event); __Pyx_RefNannyFinishContext(); return __pyx_r; }
486: """
487:
488: .. versionchanged:: 1.1a1
489: If *unfinished_tasks* is not given, then all the given *items*
490: (if any) will be considered unfinished.
491:
492: """
+493: Queue.__init__(self, maxsize, items, _warn_depth=3)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_queue_Queue), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); __Pyx_INCREF(__pyx_v_maxsize); __Pyx_GIVEREF(__pyx_v_maxsize); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_maxsize); __Pyx_INCREF(__pyx_v_items); __Pyx_GIVEREF(__pyx_v_items); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_items); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_warn_depth, __pyx_int_3) < 0) __PYX_ERR(0, 493, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
494:
+495: from gevent.event import Event
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_n_s_Event); __Pyx_GIVEREF(__pyx_n_s_Event); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Event); __pyx_t_3 = __Pyx_Import(__pyx_n_s_gevent_event, __pyx_t_4, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Event); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_4); __pyx_v_Event = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+496: self._cond = Event()
__Pyx_INCREF(__pyx_v_Event); __pyx_t_4 = __pyx_v_Event; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6gevent_6_event_Event))))) __PYX_ERR(0, 496, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_cond); __Pyx_DECREF(((PyObject *)__pyx_v_self->_cond)); __pyx_v_self->_cond = ((struct __pyx_obj_6gevent_6_event_Event *)__pyx_t_3); __pyx_t_3 = 0;
+497: self._cond.set()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_cond), __pyx_n_s_set); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
498:
+499: if unfinished_tasks:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_unfinished_tasks); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 499, __pyx_L1_error) if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+500: self.unfinished_tasks = unfinished_tasks
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_unfinished_tasks); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L1_error) __pyx_v_self->unfinished_tasks = __pyx_t_6;
+501: elif items:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_items); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 501, __pyx_L1_error) if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+502: 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, 502, __pyx_L1_error) __pyx_v_self->unfinished_tasks = __pyx_t_7;
503: else:
+504: self.unfinished_tasks = 0
/*else*/ { __pyx_v_self->unfinished_tasks = 0; } __pyx_L3:;
505:
+506: if self.unfinished_tasks:
__pyx_t_5 = (__pyx_v_self->unfinished_tasks != 0); if (__pyx_t_5) { /* … */ }
+507: self._cond.clear()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_cond), __pyx_n_s_clear); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
508:
+509: def copy(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue_2copy[] = "JoinableQueue.copy(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13JoinableQueue_3copy = {"copy", (PyCFunction)__pyx_pw_6gevent_6_queue_13JoinableQueue_3copy, METH_NOARGS, __pyx_doc_6gevent_6_queue_13JoinableQueue_2copy}; static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_3copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue_2copy(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13JoinableQueue_2copy(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("gevent._queue.JoinableQueue.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__60); __Pyx_GIVEREF(__pyx_tuple__60); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13JoinableQueue_3copy, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JoinableQueue_copy, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_copy, __pyx_t_6) < 0) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_copy, 509, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 509, __pyx_L1_error)
+510: return type(self)(self.maxsize, self.queue, self.unfinished_tasks)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_maxsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->unfinished_tasks); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __pyx_t_4 = ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_v_self->__pyx_base.queue, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_v_self->__pyx_base.queue, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2); __Pyx_INCREF(__pyx_v_self->__pyx_base.queue); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.queue); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self->__pyx_base.queue); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
511:
+512: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_5_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue_4_format[] = "JoinableQueue._format(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13JoinableQueue_5_format = {"_format", (PyCFunction)__pyx_pw_6gevent_6_queue_13JoinableQueue_5_format, METH_NOARGS, __pyx_doc_6gevent_6_queue_13JoinableQueue_4_format}; static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_5_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue_4_format(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13JoinableQueue_4_format(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.JoinableQueue._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_tuple__62 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__62); __Pyx_GIVEREF(__pyx_tuple__62); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13JoinableQueue_5_format, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JoinableQueue__format, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_format, __pyx_t_6) < 0) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_format, 512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 512, __pyx_L1_error)
+513: result = Queue._format(self)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6gevent_6_queue_Queue), __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+514: if self.unfinished_tasks:
__pyx_t_4 = (__pyx_v_self->unfinished_tasks != 0); if (__pyx_t_4) { /* … */ }
+515: result += ' tasks=%s _cond=%s' % (self.unfinished_tasks, self._cond)
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->unfinished_tasks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->_cond)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->_cond)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->_cond)); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_tasks_s__cond_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0;
+516: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
517:
+518: def _put(self, item):
static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_13JoinableQueue__put(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self, PyObject *__pyx_v_item, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_13JoinableQueue_7_put)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_item); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.JoinableQueue._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_6_queue_13JoinableQueue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue_6_put[] = "JoinableQueue._put(self, item)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_13JoinableQueue_7_put = {"_put", (PyCFunction)__pyx_pw_6gevent_6_queue_13JoinableQueue_7_put, METH_O, __pyx_doc_6gevent_6_queue_13JoinableQueue_6_put}; static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_7_put(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue_6_put(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13JoinableQueue_6_put(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_put", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_13JoinableQueue__put(__pyx_v_self, __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __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._queue.JoinableQueue._put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__64 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__64); __Pyx_GIVEREF(__pyx_tuple__64); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13JoinableQueue_7_put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JoinableQueue__put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_put, __pyx_t_6) < 0) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put, 518, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 518, __pyx_L1_error)
+519: Queue._put(self, item)
__pyx_t_1 = __pyx_f_6gevent_6_queue_5Queue__put(((struct __pyx_obj_6gevent_6_queue_Queue *)__pyx_v_self), __pyx_v_item, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+520: self.unfinished_tasks += 1
__pyx_v_self->unfinished_tasks = (__pyx_v_self->unfinished_tasks + 1);
+521: self._cond.clear()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_cond), __pyx_n_s_clear); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
522:
+523: def task_done(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_9task_done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue_8task_done[] = "JoinableQueue.task_done(self)\nIndicate that a formerly enqueued task is complete. Used by queue consumer threads.\n For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to :meth:`task_done` tells the queue\n that the processing on the task is complete.\n\n If 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\n Raises a :exc:`ValueError` if called more times than there were items placed in the queue.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_13JoinableQueue_9task_done = {"task_done", (PyCFunction)__pyx_pw_6gevent_6_queue_13JoinableQueue_9task_done, METH_NOARGS, __pyx_doc_6gevent_6_queue_13JoinableQueue_8task_done}; static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_9task_done(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("task_done (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue_8task_done(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13JoinableQueue_8task_done(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("task_done", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.JoinableQueue.task_done", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__66 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__66); __Pyx_GIVEREF(__pyx_tuple__66); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13JoinableQueue_9task_done, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JoinableQueue_task_done, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_task_done, __pyx_t_6) < 0) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_task_done, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 523, __pyx_L1_error)
524: '''Indicate that a formerly enqueued task is complete. Used by queue consumer threads.
525: For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to :meth:`task_done` tells the queue
526: that the processing on the task is complete.
527:
528: If a :meth:`join` is currently blocking, it will resume when all items have been processed
529: (meaning that a :meth:`task_done` call was received for every item that had been
530: :meth:`put <Queue.put>` into the queue).
531:
532: Raises a :exc:`ValueError` if called more times than there were items placed in the queue.
533: '''
+534: if self.unfinished_tasks <= 0:
__pyx_t_1 = ((__pyx_v_self->unfinished_tasks <= 0) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+535: raise ValueError('task_done() called too many times')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __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, 535, __pyx_L1_error) /* … */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_task_done_called_too_many_times); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5);
+536: self.unfinished_tasks -= 1
__pyx_v_self->unfinished_tasks = (__pyx_v_self->unfinished_tasks - 1);
+537: if self.unfinished_tasks == 0:
__pyx_t_1 = ((__pyx_v_self->unfinished_tasks == 0) != 0); if (__pyx_t_1) { /* … */ }
+538: self._cond.set()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_cond), __pyx_n_s_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
539:
+540: def join(self, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_11join(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_13JoinableQueue_10join[] = "JoinableQueue.join(self, timeout=None)\n\n Block until all items in the queue have been gotten and processed.\n\n The count of unfinished tasks goes up whenever an item is added to the queue.\n The count goes down whenever a consumer thread calls :meth:`task_done` to indicate\n that the item was retrieved and all work on it is complete. When the count of\n unfinished 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.\n "; static PyMethodDef __pyx_mdef_6gevent_6_queue_13JoinableQueue_11join = {"join", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_13JoinableQueue_11join, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_13JoinableQueue_10join}; static PyObject *__pyx_pw_6gevent_6_queue_13JoinableQueue_11join(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_timeout,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "join") < 0)) __PYX_ERR(0, 540, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_timeout = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("join", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 540, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.JoinableQueue.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_13JoinableQueue_10join(((struct __pyx_obj_6gevent_6_queue_JoinableQueue *)__pyx_v_self), __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_13JoinableQueue_10join(struct __pyx_obj_6gevent_6_queue_JoinableQueue *__pyx_v_self, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("gevent._queue.JoinableQueue.join", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__68); __Pyx_GIVEREF(__pyx_tuple__68); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_13JoinableQueue_11join, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JoinableQueue_join, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_JoinableQueue->tp_dict, __pyx_n_s_join, __pyx_t_6) < 0) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_JoinableQueue); __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_join, 540, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 540, __pyx_L1_error)
541: '''
542: Block until all items in the queue have been gotten and processed.
543:
544: The count of unfinished tasks goes up whenever an item is added to the queue.
545: The count goes down whenever a consumer thread calls :meth:`task_done` to indicate
546: that the item was retrieved and all work on it is complete. When the count of
547: unfinished tasks drops to zero, :meth:`join` unblocks.
548:
549: :param float timeout: If not ``None``, then wait no more than this time in seconds
550: for all tasks to finish.
551: :return: ``True`` if all tasks have finished; if ``timeout`` was given and expired before
552: all tasks finished, ``False``.
553:
554: .. versionchanged:: 1.1a1
555: Add the *timeout* parameter.
556: '''
+557: return self._cond.wait(timeout=timeout)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_cond), __pyx_n_s_wait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_timeout, __pyx_v_timeout) < 0) __PYX_ERR(0, 557, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
558:
559:
+560: class Channel(object):
struct __pyx_vtabstruct_6gevent_6_queue_Channel { PyObject *(*get)(struct __pyx_obj_6gevent_6_queue_Channel *, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_7Channel_get *__pyx_optional_args); PyObject *(*get_nowait)(struct __pyx_obj_6gevent_6_queue_Channel *, int __pyx_skip_dispatch); PyObject *(*_schedule_unlock)(struct __pyx_obj_6gevent_6_queue_Channel *); }; static struct __pyx_vtabstruct_6gevent_6_queue_Channel *__pyx_vtabptr_6gevent_6_queue_Channel;
561:
562: __slots__ = (
+563: 'getters',
if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_slots, __pyx_tuple__70) < 0) __PYX_ERR(0, 562, __pyx_L1_error) PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); /* … */ __pyx_tuple__70 = PyTuple_Pack(5, __pyx_n_s_getters, __pyx_n_s_putters, __pyx_n_s_hub, __pyx_n_s_event_unlock, __pyx_n_s_weakref); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__70); __Pyx_GIVEREF(__pyx_tuple__70);
564: 'putters',
565: 'hub',
566: '_event_unlock',
567: '__weakref__',
568: )
569:
+570: def __init__(self, maxsize=1):
/* Python wrapper */ static int __pyx_pw_6gevent_6_queue_7Channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6gevent_6_queue_7Channel_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_maxsize = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxsize,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_int_1); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 570, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_maxsize = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 570, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_7Channel___init__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self), __pyx_v_maxsize); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6gevent_6_queue_7Channel___init__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self, PyObject *__pyx_v_maxsize) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.Channel.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
571: # We take maxsize to simplify certain kinds of code
+572: if maxsize != 1:
__pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_maxsize, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __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, 572, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+573: raise ValueError("Channels have a maxsize of 1")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __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, 573, __pyx_L1_error) /* … */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Channels_have_a_maxsize_of_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6);
+574: self.getters = collections.deque()
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_deque); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->getters); __Pyx_DECREF(__pyx_v_self->getters); __pyx_v_self->getters = __pyx_t_1; __pyx_t_1 = 0;
+575: self.putters = collections.deque()
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_collections); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_deque); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->putters); __Pyx_DECREF(__pyx_v_self->putters); __pyx_v_self->putters = __pyx_t_1; __pyx_t_1 = 0;
+576: self.hub = get_hub()
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_hub); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->hub); __Pyx_DECREF(__pyx_v_self->hub); __pyx_v_self->hub = __pyx_t_1; __pyx_t_1 = 0;
+577: 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;
578:
+579: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_3__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_3__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_2__repr__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_2__repr__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._queue.Channel.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+580: 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_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_hex, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_at_s_s_2, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
581:
+582: def __str__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_5__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_5__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_4__str__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_4__str__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.Channel.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+583: 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_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_s_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
584:
+585: def _format(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_7_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_6_format[] = "Channel._format(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_7_format = {"_format", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_7_format, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_6_format}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_7_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_6_format(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_6_format(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_format", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("gevent._queue.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_tuple__71 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_result); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__71); __Pyx_GIVEREF(__pyx_tuple__71); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_7_format, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel__format, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_format, __pyx_t_6) < 0) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_format, 585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 585, __pyx_L1_error)
+586: result = ''
__Pyx_INCREF(__pyx_kp_s__3);
__pyx_v_result = __pyx_kp_s__3;
+587: if self.getters:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 587, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+588: 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, 588, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_getters_s_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(PyString_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0;
+589: if self.putters:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 589, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+590: 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, 590, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_putters_s_2, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(PyString_CheckExact(__pyx_t_2))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0;
+591: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
592:
593: @property
+594: def balance(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_7balance_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_7balance_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_7balance___get__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_7balance___get__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._queue.Channel.balance.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+595: 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, 595, __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, 595, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_2 - __pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
596:
+597: def qsize(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_9qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_8qsize[] = "Channel.qsize(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_9qsize = {"qsize", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_9qsize, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_8qsize}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_9qsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_8qsize(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_8qsize(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("qsize", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__73); __Pyx_GIVEREF(__pyx_tuple__73); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_9qsize, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_qsize, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_qsize, __pyx_t_6) < 0) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_qsize, 597, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 597, __pyx_L1_error)
+598: return 0
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; goto __pyx_L0;
599:
+600: def empty(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_11empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_10empty[] = "Channel.empty(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_11empty = {"empty", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_11empty, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_10empty}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_11empty(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_10empty(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_10empty(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("empty", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__75); __Pyx_GIVEREF(__pyx_tuple__75); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_11empty, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_empty, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_empty, __pyx_t_6) < 0) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_empty, 600, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 600, __pyx_L1_error)
+601: return True
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0;
602:
+603: def full(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_13full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_12full[] = "Channel.full(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_13full = {"full", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_13full, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_12full}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_13full(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_12full(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_12full(CYTHON_UNUSED struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("full", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__77 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__77); __Pyx_GIVEREF(__pyx_tuple__77); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_13full, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_full, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_full, __pyx_t_6) < 0) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_full, 603, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 603, __pyx_L1_error)
+604: return True
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0;
605:
+606: def put(self, item, block=True, timeout=None):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_15put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_14put[] = "Channel.put(self, item, block=True, timeout=None)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_15put = {"put", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_7Channel_15put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_7Channel_14put}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_15put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_item = 0; PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_item,&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[3] = {0,0,0}; values[1] = ((PyObject *)Py_True); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) __PYX_ERR(0, 606, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_item = values[0]; __pyx_v_block = values[1]; __pyx_v_timeout = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("put", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 606, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Channel.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_14put(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self), __pyx_v_item, __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_14put(struct __pyx_obj_6gevent_6_queue_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_8__waiter_Waiter *__pyx_v_waiter = NULL; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put", 0); __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_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("gevent._queue.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_tuple__79 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_item, __pyx_n_s_block, __pyx_n_s_timeout, __pyx_n_s_getter, __pyx_n_s_waiter_2, __pyx_n_s_result); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__79); __Pyx_GIVEREF(__pyx_tuple__79); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_15put, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_put, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_put_2, __pyx_t_6) < 0) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_2, 606, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 606, __pyx_L1_error)
+607: if self.hub is getcurrent():
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { /* … */ }
+608: if self.getters:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 608, __pyx_L1_error) if (__pyx_t_5) { /* … */ }
+609: getter = self.getters.popleft()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->getters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_getter = __pyx_t_1; __pyx_t_1 = 0;
+610: getter.switch(item)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_getter, __pyx_n_s_switch); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_item); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+611: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+612: raise Full
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __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, 612, __pyx_L1_error)
613:
+614: if not block:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 614, __pyx_L1_error) __pyx_t_4 = ((!__pyx_t_5) != 0); if (__pyx_t_4) { /* … */ }
+615: timeout = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_int_0);
616:
+617: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_waiter = ((struct __pyx_obj_6gevent_8__waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+618: item = (item, waiter)
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_item); __Pyx_INCREF(((PyObject *)__pyx_v_waiter)); __Pyx_GIVEREF(((PyObject *)__pyx_v_waiter)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_waiter)); __Pyx_DECREF_SET(__pyx_v_item, __pyx_t_1); __pyx_t_1 = 0;
+619: self.putters.append(item)
__pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_self->putters, __pyx_v_item); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 619, __pyx_L1_error)
+620: timeout = Timeout._start_new_or_dummy(timeout, Full)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_2}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_2}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_timeout); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+621: try:
/*try:*/ { { /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L14_try_end; __pyx_L9_error:; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); goto __pyx_L7_error; __pyx_L14_try_end:; } }
+622: if self.getters:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_self->getters); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 622, __pyx_L9_error) if (__pyx_t_4) { /* … */ }
+623: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Channel *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+624: result = waiter.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_8__waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+625: if result is not waiter:
__pyx_t_4 = (__pyx_v_result != ((PyObject *)__pyx_v_waiter)); __pyx_t_5 = (__pyx_t_4 != 0); if (unlikely(__pyx_t_5)) { /* … */ }
+626: raise InvalidSwitchError("Invalid switch into Channel.put: %r" % (result, ))
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_InvalidSwitchError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 626, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_result); __Pyx_GIVEREF(__pyx_v_result); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_result); __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_switch_into_Channel_put, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 626, __pyx_L9_error)
+627: except:
/*except:*/ { __Pyx_AddTraceback("gevent._queue.Channel.put", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 627, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_2);
+628: _safe_remove(self.putters, item)
__pyx_t_9 = __pyx_v_self->putters; __Pyx_INCREF(__pyx_t_9); __pyx_t_7 = __pyx_f_6gevent_6_queue__safe_remove(__pyx_t_9, __pyx_v_item); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 628, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+629: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_3, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __PYX_ERR(0, 629, __pyx_L11_except_error) } __pyx_L11_except_error:;
630: finally:
+631: timeout.cancel()
/*finally:*/ { /*normal exit:*/{ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L8; } __pyx_L7_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __pyx_t_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 631, __pyx_L20_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L20_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10); __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; goto __pyx_L1_error; __pyx_L20_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; goto __pyx_L1_error; } __pyx_L8:; }
632:
+633: def put_nowait(self, item):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_17put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_16put_nowait[] = "Channel.put_nowait(self, item)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_17put_nowait = {"put_nowait", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_17put_nowait, METH_O, __pyx_doc_6gevent_6_queue_7Channel_16put_nowait}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_17put_nowait(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_16put_nowait(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self), ((PyObject *)__pyx_v_item)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_16put_nowait(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_nowait", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("gevent._queue.Channel.put_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__81 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_item); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__81); __Pyx_GIVEREF(__pyx_tuple__81); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_17put_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_put_nowait, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_put_nowait, __pyx_t_6) < 0) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_put_nowait, 633, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 633, __pyx_L1_error)
+634: self.put(item, False)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_item, Py_False}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_item, Py_False}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_item); __Pyx_GIVEREF(__pyx_v_item); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_item); __Pyx_INCREF(Py_False); __Pyx_GIVEREF(Py_False); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_False); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
635:
+636: def get(self, block=True, timeout=None):
static PyObject *__pyx_pw_6gevent_6_queue_7Channel_19get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_7Channel_get(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_6gevent_6_queue_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_8__waiter_Waiter *__pyx_v_waiter = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_block = __pyx_optional_args->block; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_timeout = __pyx_optional_args->timeout; } } } __Pyx_INCREF(__pyx_v_timeout); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_7Channel_19get)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_block, __pyx_v_timeout}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_block); __Pyx_GIVEREF(__pyx_v_block); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_block); __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_timeout); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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_6); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("gevent._queue.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_6_queue_7Channel_19get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_18get[] = "Channel.get(self, block=True, timeout=None)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_19get = {"get", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6gevent_6_queue_7Channel_19get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6gevent_6_queue_7Channel_18get}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_19get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_block = 0; PyObject *__pyx_v_timeout = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_block,&__pyx_n_s_timeout,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)Py_True); values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_block); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_timeout); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) __PYX_ERR(0, 636, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_block = values[0]; __pyx_v_timeout = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 636, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gevent._queue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_18get(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self), __pyx_v_block, __pyx_v_timeout); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_18get(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self, PyObject *__pyx_v_block, PyObject *__pyx_v_timeout) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.block = __pyx_v_block; __pyx_t_2.timeout = __pyx_v_timeout; __pyx_t_1 = __pyx_vtabptr_6gevent_6_queue_Channel->get(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __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._queue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_block, __pyx_n_s_timeout); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__83); __Pyx_GIVEREF(__pyx_tuple__83); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_19get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_get, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_get_2, __pyx_t_6) < 0) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get_2, 636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 636, __pyx_L1_error)
+637: if self.hub is getcurrent():
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_getcurrent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (__pyx_v_self->hub == __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ }
+638: if self.putters:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 638, __pyx_L1_error) if (__pyx_t_8) { /* … */ }
+639: item, putter = self.putters.popleft()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->putters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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, 639, __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_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_6), 2) < 0) __PYX_ERR(0, 639, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 639, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_v_item = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_putter = __pyx_t_3; __pyx_t_3 = 0;
+640: self.hub.loop.run_callback(putter.switch, putter)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_n_s_loop); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_n_s_switch); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_v_putter}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_v_putter}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_v_putter); __Pyx_GIVEREF(__pyx_v_putter); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_putter); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+641: return item
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_item); __pyx_r = __pyx_v_item; goto __pyx_L0;
642:
+643: if not block:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_block); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 643, __pyx_L1_error) __pyx_t_7 = ((!__pyx_t_8) != 0); if (__pyx_t_7) { /* … */ }
+644: timeout = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_int_0);
645:
+646: waiter = Waiter() # pylint:disable=undefined-variable
__pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6gevent_8__waiter_Waiter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_waiter = ((struct __pyx_obj_6gevent_8__waiter_Waiter *)__pyx_t_1); __pyx_t_1 = 0;
+647: timeout = Timeout._start_new_or_dummy(timeout, Empty)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_start_new_or_dummy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_timeout, __pyx_t_2}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_timeout, __pyx_t_2}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_timeout); __Pyx_GIVEREF(__pyx_v_timeout); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_timeout); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_timeout, __pyx_t_1); __pyx_t_1 = 0;
+648: try:
/*try:*/ { { /*try:*/ { /* … */ } __pyx_L11_error:; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); goto __pyx_L9_error; __pyx_L15_try_return:; __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); goto __pyx_L8_return; } }
+649: self.getters.append(waiter)
__pyx_t_13 = __Pyx_PyObject_Append(__pyx_v_self->getters, ((PyObject *)__pyx_v_waiter)); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 649, __pyx_L11_error)
+650: if self.putters:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_self->putters); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 650, __pyx_L11_error) if (__pyx_t_7) { /* … */ }
+651: self._schedule_unlock()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Channel *)__pyx_v_self->__pyx_vtab)->_schedule_unlock(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+652: return waiter.get()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_8__waiter_Waiter *)__pyx_v_waiter->__pyx_vtab)->get(__pyx_v_waiter, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L15_try_return;
+653: except:
/*except:*/ { __Pyx_AddTraceback("gevent._queue.Channel.get", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 653, __pyx_L13_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_6);
+654: self.getters.remove(waiter)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->getters, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L13_except_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_14)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_14, ((PyObject *)__pyx_v_waiter)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_waiter)); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L13_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+655: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_4, __pyx_t_6); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_6 = 0; __PYX_ERR(0, 655, __pyx_L13_except_error) } __pyx_L13_except_error:;
656: finally:
+657: timeout.close()
/*finally:*/ { __pyx_L9_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_5 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; { __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 657, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 657, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } if (PY_MAJOR_VERSION >= 3) { __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_12); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_11, __pyx_t_10); __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_5; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; goto __pyx_L1_error; __pyx_L21_error:; if (PY_MAJOR_VERSION >= 3) { __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_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_timeout, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = __pyx_t_19; __pyx_t_19 = 0; goto __pyx_L0; } }
658:
+659: def get_nowait(self):
static PyObject *__pyx_pw_6gevent_6_queue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_f_6gevent_6_queue_7Channel_get_nowait(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_nowait); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_6gevent_6_queue_7Channel_21get_nowait)) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #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._queue.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_6_queue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_20get_nowait[] = "Channel.get_nowait(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_21get_nowait = {"get_nowait", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_21get_nowait, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_20get_nowait}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_21get_nowait(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_20get_nowait(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_20get_nowait(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nowait", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_6gevent_6_queue_7Channel_get_nowait(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __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._queue.Channel.get_nowait", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__85 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__85); __Pyx_GIVEREF(__pyx_tuple__85); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_21get_nowait, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel_get_nowait, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_get_nowait, __pyx_t_6) < 0) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel); __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_gevent_queue_py, __pyx_n_s_get_nowait, 659, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 659, __pyx_L1_error)
+660: return self.get(False)
__Pyx_XDECREF(__pyx_r); __pyx_t_5.__pyx_n = 1; __pyx_t_5.block = Py_False; __pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Channel *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
661:
+662: def _unlock(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_23_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6gevent_6_queue_7Channel_22_unlock[] = "Channel._unlock(self)"; static PyMethodDef __pyx_mdef_6gevent_6_queue_7Channel_23_unlock = {"_unlock", (PyCFunction)__pyx_pw_6gevent_6_queue_7Channel_23_unlock, METH_NOARGS, __pyx_doc_6gevent_6_queue_7Channel_22_unlock}; static PyObject *__pyx_pw_6gevent_6_queue_7Channel_23_unlock(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_22_unlock(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_22_unlock(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_v_getter = NULL; PyObject *__pyx_v_item = NULL; PyObject *__pyx_v_putter = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_unlock", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue.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_tuple__87 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_getter, __pyx_n_s_item, __pyx_n_s_putter); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 662, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__87); __Pyx_GIVEREF(__pyx_tuple__87); /* … */ __pyx_t_6 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6gevent_6_queue_7Channel_23_unlock, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Channel__unlock, NULL, __pyx_n_s_gevent__queue, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 662, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_unlock, __pyx_t_6) < 0) __PYX_ERR(0, 662, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel);
+663: 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, 663, __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, 663, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L5_bool_binop_done:; if (!__pyx_t_1) break;
+664: getter = self.getters.popleft()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->getters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_getter, __pyx_t_3); __pyx_t_3 = 0;
+665: item, putter = self.putters.popleft()
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->putters, __pyx_n_s_popleft); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; 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, 665, __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_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_4 = PyList_GET_ITEM(sequence, 0); __pyx_t_5 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); #else __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 665, __pyx_L1_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L8_unpacking_done; __pyx_L7_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 665, __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_5); __pyx_t_5 = 0;
+666: getter.switch(item)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_getter, __pyx_n_s_switch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_item) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_item); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+667: putter.switch(putter)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_putter, __pyx_n_s_switch); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_putter) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_putter); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; }
668:
+669: def _schedule_unlock(self):
static PyObject *__pyx_f_6gevent_6_queue_7Channel__schedule_unlock(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_schedule_unlock", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("gevent._queue.Channel._schedule_unlock", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+670: 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, 670, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { /* … */ }
+671: self._event_unlock = self.hub.loop.run_callback(self._unlock)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->hub, __pyx_n_s_loop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_run_callback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_unlock); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __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;
672:
+673: def __iter__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_25__iter__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_25__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_24__iter__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_24__iter__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+674: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
675:
+676: def __next__(self):
/* Python wrapper */ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_27__next__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6gevent_6_queue_7Channel_27__next__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__ (wrapper)", 0); __pyx_r = __pyx_pf_6gevent_6_queue_7Channel_26__next__(((struct __pyx_obj_6gevent_6_queue_Channel *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6gevent_6_queue_7Channel_26__next__(struct __pyx_obj_6gevent_6_queue_Channel *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__next__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("gevent._queue.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; }
+677: result = self.get()
__pyx_t_1 = ((struct __pyx_vtabstruct_6gevent_6_queue_Channel *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0;
+678: if result is StopIteration:
__pyx_t_2 = (__pyx_v_result == __pyx_builtin_StopIteration); __pyx_t_3 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+679: raise result
__Pyx_Raise(__pyx_v_result, 0, 0, 0); __PYX_ERR(0, 679, __pyx_L1_error)
+680: return result
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); __pyx_r = __pyx_v_result; goto __pyx_L0;
681:
+682: next = __next__ # Py2
__Pyx_GetNameInClass(__pyx_t_6, (PyObject *)__pyx_ptype_6gevent_6_queue_Channel, __pyx_n_s_next); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem((PyObject *)__pyx_ptype_6gevent_6_queue_Channel->tp_dict, __pyx_n_s_next_2, __pyx_t_6) < 0) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; PyType_Modified(__pyx_ptype_6gevent_6_queue_Channel);
683:
+684: from gevent._util import import_c_accel
__pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_n_s_import_c_accel); __Pyx_GIVEREF(__pyx_n_s_import_c_accel); PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_import_c_accel); __pyx_t_1 = __Pyx_Import(__pyx_n_s_gevent__util, __pyx_t_6, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_c_accel, __pyx_t_6) < 0) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+685: import_c_accel(globals(), 'gevent._queue')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_import_c_accel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_Globals(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_INCREF(__pyx_n_s_gevent__queue); __Pyx_GIVEREF(__pyx_n_s_gevent__queue); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_gevent__queue); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 685, __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_DECREF(__pyx_t_6); __pyx_t_6 = 0;