summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-10-09 03:27:22 (GMT)
committerGuido van Rossum <guido@python.org>2016-10-09 03:27:22 (GMT)
commite259267e52fb14571ae3845d3d93985ad96425b9 (patch)
tree86494f80bfb51d66ee97c0ec7da8fbb42e456528 /Lib/typing.py
parent7b2aa2e87c524f165f7664fbe473d0be10af8c7a (diff)
downloadcpython-e259267e52fb14571ae3845d3d93985ad96425b9.zip
cpython-e259267e52fb14571ae3845d3d93985ad96425b9.tar.gz
cpython-e259267e52fb14571ae3845d3d93985ad96425b9.tar.bz2
Merge further typing.py changes from upstream.
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index 05b65b7..557fa58 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -993,7 +993,10 @@ class GenericMeta(TypingMeta, abc.ABCMeta):
# This allows unparameterized generic collections to be used
# with issubclass() and isinstance() in the same way as their
# collections.abc counterparts (e.g., isinstance([], Iterable)).
- self.__subclasshook__ = _make_subclasshook(self)
+ if ('__subclasshook__' not in namespace and extra # allow overriding
+ or hasattr(self.__subclasshook__, '__name__') and
+ self.__subclasshook__.__name__ == '__extrahook__'):
+ self.__subclasshook__ = _make_subclasshook(self)
if isinstance(extra, abc.ABCMeta):
self._abc_registry = extra._abc_registry
return self