summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/_weakrefset.py3
-rw-r--r--Lib/test/test_genericalias.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/Lib/_weakrefset.py b/Lib/_weakrefset.py
index 7a84823622..b267780f0c 100644
--- a/Lib/_weakrefset.py
+++ b/Lib/_weakrefset.py
@@ -3,6 +3,7 @@
# by abc.py to load everything else at startup.
from _weakref import ref
+from types import GenericAlias
__all__ = ['WeakSet']
@@ -197,3 +198,5 @@ class WeakSet:
def __repr__(self):
return repr(self.data)
+
+ __class_getitem__ = classmethod(GenericAlias)
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index 770aeef451..686df17d6a 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -33,6 +33,7 @@ from tempfile import TemporaryDirectory, SpooledTemporaryFile
from urllib.parse import SplitResult, ParseResult
from unittest.case import _AssertRaisesContext
from queue import Queue, SimpleQueue
+from weakref import WeakSet, ReferenceType, ref
import typing
from typing import TypeVar
@@ -73,6 +74,7 @@ class BaseTest(unittest.TestCase):
Array, LibraryLoader,
SplitResult, ParseResult,
ValueProxy, ApplyResult,
+ WeakSet, ReferenceType, ref,
ShareableList, SimpleQueue,
Future, _WorkItem,
Morsel,