◐ Shell
clean mode source ↗

bpo-41521: Replace whitelist/blacklist with allowlist/denylist by vstinner · Pull Request #21824 · python/cpython

@vstinner

This change is backward incompatible, but test.support doesn't provide any backward compatibility warranty:

"The test package is meant for internal use by Python only."
https://docs.python.org/dev/library/test.html

At least, I wrote a NEWS entry to document the change.

@serhiy-storchaka

Is denylist a good name? It does not deny anything. It is just a sequence of non-underscored names which are found in the module's dir(), but are absent in __all__. It is an opposite to the extra parameter. Maybe skip or exclude be better name?

@vsajip

I agree with Serhiy about denylist in this specific instance. Since the parameter intended to specify public-seeming names that should in fact be private, I would suggest a name such as keep_private would be most in keeping with the desired intent.

@serhiy-storchaka

They are not necessary private. They are just not imported by star-import. For example from calendar import * does not add January and MONDAY to your globals, but calendar.January and calendar.MONDAY are public names.

@vsajip

Fair point. So then dont_export for the parameter name? (Or maybe dont_wildcard_export.)

@vstinner

dont_export: check__all__() function doesn't export anything. Maybe not_exported?

Is denylist a good name? It does not deny anything.

Well, nobody said that "blacklist" was a best term in the first place :-D

@serhiy-storchaka, @vsajip: What do you think of ignore or ignore_list name?

@vsajip

IMO ignore doesn't convey what the effect of ignoring is, so not_exported seems more expressive.

Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".

@vstinner

@vsajip: Ok, I modified my PR to use not_exported name instead. It's a better name than "blacklist".

@vstinner

vsajip

@vstinner

@vsajip @serhiy-storchaka: Thank you for your reviews, "not_exported" is a better name than "denylist" (or "blacklist") ;-)

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request

Aug 20, 2020
Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".

xzy3 pushed a commit to xzy3/cpython that referenced this pull request

Oct 18, 2020
Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".