From: Victor Stinner Date: Wed, 12 Aug 2020 08:53:12 +0000 (+0200) Subject: bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825) X-Git-Tag: v3.10.0a1~268 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e95bbf08571e98f4b688524efc2dcf20d315d91;p=thirdparty%2FPython%2Fcpython.git bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825) --- diff --git a/Lib/typing.py b/Lib/typing.py index 5da032bbee8f..fce8da4fe3cf 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1021,7 +1021,7 @@ def _allow_reckless_class_cheks(): return True -_PROTO_WHITELIST = { +_PROTO_ALLOWLIST = { 'collections.abc': [ 'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable', 'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', @@ -1140,8 +1140,8 @@ class Protocol(Generic, metaclass=_ProtocolMeta): # ... otherwise check consistency of bases, and prohibit instantiation. for base in cls.__bases__: if not (base in (object, Generic) or - base.__module__ in _PROTO_WHITELIST and - base.__name__ in _PROTO_WHITELIST[base.__module__] or + base.__module__ in _PROTO_ALLOWLIST and + base.__name__ in _PROTO_ALLOWLIST[base.__module__] or issubclass(base, Generic) and base._is_protocol): raise TypeError('Protocols can only inherit from other' ' protocols, got %r' % base)