From 8ef875028a3644a329c87ce420a73793e315143f Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 13 Apr 2020 21:54:40 -0700 Subject: bpo-39481: Make weakref and WeakSet generic (GH-19497) --- Lib/_weakrefset.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/_weakrefset.py') 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) -- cgit v1.2.1