summaryrefslogtreecommitdiffstats
path: root/Lib/queue.py
diff options
context:
space:
mode:
authorBatuhan Taşkaya <batuhanosmantaskaya@gmail.com>2020-04-10 14:46:36 (GMT)
committerGitHub <noreply@github.com>2020-04-10 14:46:36 (GMT)
commit0361556537686f857f1025ead75e6af4ca7cc94a (patch)
tree3cce4f12e341d4266d1308f94a92a7c4b25bcdf9 /Lib/queue.py
parente3ec44d692d9442e640cf5b2d8708157a65cec3e (diff)
downloadcpython-0361556537686f857f1025ead75e6af4ca7cc94a.zip
cpython-0361556537686f857f1025ead75e6af4ca7cc94a.tar.gz
cpython-0361556537686f857f1025ead75e6af4ca7cc94a.tar.bz2
bpo-39481: PEP 585 for a variety of modules (GH-19423)
- concurrent.futures - ctypes - http.cookies - multiprocessing - queue - tempfile - unittest.case - urllib.parse
Diffstat (limited to 'Lib/queue.py')
-rw-r--r--Lib/queue.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/queue.py b/Lib/queue.py
index 5bb0431..10dbcbc 100644
--- a/Lib/queue.py
+++ b/Lib/queue.py
@@ -1,6 +1,7 @@
'''A multi-producer, multi-consumer queue.'''
import threading
+import types
from collections import deque
from heapq import heappush, heappop
from time import monotonic as time
@@ -216,6 +217,8 @@ class Queue:
def _get(self):
return self.queue.popleft()
+ __class_getitem__ = classmethod(types.GenericAlias)
+
class PriorityQueue(Queue):
'''Variant of Queue that retrieves open entries in priority order (lowest first).
@@ -316,6 +319,8 @@ class _PySimpleQueue:
'''Return the approximate size of the queue (not reliable!).'''
return len(self._queue)
+ __class_getitem__ = classmethod(types.GenericAlias)
+
if SimpleQueue is None:
SimpleQueue = _PySimpleQueue