mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
[3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785)
Automerge-Triggered-By: GH:asvetlov
This commit is contained in:
parent
3c4a3745b9
commit
6ed874f8c5
8 changed files with 29 additions and 24 deletions
|
@ -3,6 +3,7 @@ __all__ = ('Queue', 'PriorityQueue', 'LifoQueue', 'QueueFull', 'QueueEmpty')
|
|||
import collections
|
||||
import heapq
|
||||
import warnings
|
||||
from types import GenericAlias
|
||||
|
||||
from . import events
|
||||
from . import locks
|
||||
|
@ -76,8 +77,7 @@ class Queue:
|
|||
def __str__(self):
|
||||
return f'<{type(self).__name__} {self._format()}>'
|
||||
|
||||
def __class_getitem__(cls, type):
|
||||
return cls
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
||||
def _format(self):
|
||||
result = f'maxsize={self._maxsize!r}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue