◐ Shell
reader mode source ↗
Skip to content

bpo-41521: Replace whitelist/blacklist with allowlist/denylist#21824

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:support_blacklist
Aug 17, 2020
Merged

bpo-41521: Replace whitelist/blacklist with allowlist/denylist#21824
vstinner merged 1 commit into
python:masterfrom
vstinner:support_blacklist

Conversation

@vstinner

@vstinner vstinner commented Aug 11, 2020

Copy link
Copy Markdown
Member

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

https://bugs.python.org/issue41521

@vstinner

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Member

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

vsajip commented Aug 12, 2020

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

vsajip commented Aug 12, 2020

Copy link
Copy Markdown
Member

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

@vstinner

Copy link
Copy Markdown
Member Author

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

vsajip commented Aug 13, 2020

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

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

@vstinner

Copy link
Copy Markdown
Member Author

@serhiy-storchaka @vsajip: Would you mind to review the updated PR?

@vstinner vstinner merged commit fbf43f0 into python:master Aug 17, 2020
@vstinner vstinner deleted the support_blacklist branch August 17, 2020 05:20
@vstinner

Copy link
Copy Markdown
Member Author

@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".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants