bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)

Automerge-Triggered-By: @tiran
This commit is contained in:
Victor Stinner 2020-08-11 15:26:59 +02:00 committed by GitHub
parent 1d541c25c8
commit fabd7bb8e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 36 additions and 36 deletions

View file

@ -4171,10 +4171,10 @@ object_set_class(PyObject *self, PyObject *value, void *closure)
In theory the proper fix would be to identify which classes rely on
this invariant and somehow disallow __class__ assignment only for them,
perhaps via some mechanism like a new Py_TPFLAGS_IMMUTABLE flag (a
"blacklisting" approach). But in practice, since this problem wasn't
"denylisting" approach). But in practice, since this problem wasn't
noticed late in the 3.5 RC cycle, we're taking the conservative
approach and reinstating the same HEAPTYPE->HEAPTYPE check that we used
to have, plus a "whitelist". For now, the whitelist consists only of
to have, plus an "allowlist". For now, the allowlist consists only of
ModuleType subtypes, since those are the cases that motivated the patch
in the first place -- see https://bugs.python.org/issue22986 -- and
since module objects are mutable we can be sure that they are