Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Aug 17, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Aug 11, 2020

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

https://bugs.python.org/issue41521

@vstinner
Copy link
Member Author

vstinner commented Aug 11, 2020

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
Member

serhiy-storchaka commented Aug 12, 2020

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
Copy link
Member

vsajip commented Aug 12, 2020

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
Member

serhiy-storchaka commented Aug 12, 2020

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
Copy link
Member

vsajip commented Aug 12, 2020

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

@vstinner
Copy link
Member Author

vstinner commented Aug 12, 2020

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
Copy link
Member

vsajip commented Aug 13, 2020

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
Member Author

vstinner commented Aug 13, 2020

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

@vstinner
Copy link
Member Author

vstinner commented Aug 14, 2020

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

vsajip
vsajip approved these changes Aug 15, 2020
@vstinner vstinner merged commit fbf43f0 into python:master Aug 17, 2020
4 checks passed
@vstinner vstinner deleted the support_blacklist branch Aug 17, 2020
@vstinner
Copy link
Member Author

vstinner commented Aug 17, 2020

@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.

None yet

5 participants