From 22ec4520c1b73143b66e275c31a8026757f9dae6 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Tue, 8 Oct 2019 12:59:06 +0300 Subject: [PATCH 1/2] Documentation update for bpo-32996 fix. PR #4906 changed the typing.Generic class hierarchy, leaving an outdated comment in the library reference. User-defined Generic ABCs now must get a abc.ABCMeta metaclass from something other than typing.Generic inheritance. --- Doc/library/typing.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index f4d1b2404328dd..6420222932d763 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -307,9 +307,10 @@ User defined generic type aliases are also supported. Examples:: def inproduct(v: Vec[T]) -> T: # Same as Iterable[Tuple[T, T]] return sum(x*y for x, y in v) -The metaclass used by :class:`Generic` is a subclass of :class:`abc.ABCMeta`. -A generic class can be an ABC by including abstract methods or properties, -and generic classes can also have ABCs as base classes without a metaclass +.. versionchanged:: 3.7 + :class:`Generic` no longer has a metaclass. + +A user-defined generic class can have ABCs as base classes without a metaclass conflict. Generic metaclasses are not supported. The outcome of parameterizing generics is cached, and most types in the typing module are hashable and comparable for equality. From 54bb8a604ef5211cc62464a44e2e2ea15ef2c4f7 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Tue, 8 Oct 2019 21:22:25 +0300 Subject: [PATCH 2/2] Update Doc/library/typing.rst Co-Authored-By: Ivan Levkivskyi --- Doc/library/typing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 6420222932d763..642f8c653eeb5d 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -308,7 +308,7 @@ User defined generic type aliases are also supported. Examples:: return sum(x*y for x, y in v) .. versionchanged:: 3.7 - :class:`Generic` no longer has a metaclass. + :class:`Generic` no longer has a custom metaclass. A user-defined generic class can have ABCs as base classes without a metaclass conflict. Generic metaclasses are not supported. The outcome of parameterizing