]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825)
authorVictor Stinner <vstinner@python.org>
Wed, 12 Aug 2020 08:53:12 +0000 (10:53 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Aug 2020 08:53:12 +0000 (10:53 +0200)
Lib/typing.py

index 5da032bbee8f1e871885d921a7e51082f217128b..fce8da4fe3cf05d6e7e229a4073898833ba2abc2 100644 (file)
@@ -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)