[Python-checkins] bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825)

Victor Stinner webhook-mailer at python.org
Wed Aug 12 04:53:25 EDT 2020

commit: 0e95bbf08571e98f4b688524efc2dcf20d315d91
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-08-12T10:53:12+02:00

bpo-41521, typing: Rename _PROTO_WHITELIST to _PROTO_ALLOWLIST (#21825)

M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index 5da032bbee8f1..fce8da4fe3cf0 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1021,7 +1021,7 @@ def _allow_reckless_class_cheks():
         return True
     'collections.abc': [
         'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
         'Hashable', 'Sized', 'Container', 'Collection', 'Reversible',
@@ -1140,8 +1140,8 @@ def _proto_hook(other):
         # ... 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)

More information about the Python-checkins mailing list