[3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785)

Automerge-Triggered-By: GH:asvetlov
This commit is contained in:
Kumar Aditya 2022-01-22 18:22:24 +05:30 committed by GitHub
parent 3c4a3745b9
commit 6ed874f8c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 24 deletions

View file

@ -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}'