Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Remove builtins from __all__ #14881

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

Merged
merged 2 commits into from
Nov 12, 2019

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Nov 11, 2019

This was introduced in 3ca0eb1, due to an incorrect implementation of __dir__ (fixed in the first commit of this patch). Looks like I never finished reviewing this part of the original PR.

It was never released, so this is not a breaking change.

In that commit, from numpy import * would reset all the builtins to their defaults, and set unicode = str, long = int.

Previously this would fail, but only on python 3.7+
```
np.new_member = 1
assert 'new_member' in dir(np)
```

While this isn't something we support anyway, it certainly wasn't intentional.
@mattip
Copy link
Member

mattip commented Nov 12, 2019

I wonder what downstream code this will break: if there are packages or users who depend on from numpy import * for all kinds of strange side effects.

Edit: ahh, never mind. My comment is to a previous verison of the PR description, now it is not relevant

@eric-wieser
Copy link
Member Author

Turns out this is actually a really recent regression, in 3ca0eb1

This was introduced in 3ca0eb1, due to an incorrect implementation of `__dir__` (fixed in the previous commit).

It was never released, so this is not a breaking change.

In that commit, `from numpy import *` would reset all the builtins to their defaults, and set `unicode = str`, `long = int`.
@eric-wieser eric-wieser changed the title API: Remove nonsensical objects from all BUG: Remove builtins from __all__ Nov 12, 2019
@eric-wieser eric-wieser force-pushed the dont-export-builtins-in-__all__ branch from 88b79e3 to 9ce99dd Compare November 12, 2019 09:26
@eric-wieser
Copy link
Member Author

Reclassified, retitled, and tagged for 1.18, with that new information.

@mattip
Copy link
Member

mattip commented Nov 12, 2019

LGTM. I will merge soon, pending other reviews

@mattip mattip merged commit 4e8ab26 into numpy:master Nov 12, 2019
@mattip
Copy link
Member

mattip commented Nov 12, 2019

Thanks for catching this @eric-wieser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants