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

Don't reexport star-imported symbols when implicit reexports are disabled #7361

Merged
merged 3 commits into from Aug 19, 2019

Conversation

@bluetech
Copy link
Contributor

commented Aug 17, 2019

Based on #7099, please see only the second commit.

Currently, in regular files, symbols imported into module A with from B import * are considered explicitly exported from module A as well, i.e.
they are considered part of module's A public API.

This behavior makes sense in stub files as a shorthand (and is specified
in PEP 484), but for regular files I think it is better to be explicit:
add the symbols to __all__.

Fixes #7042
Further discussion: #7042 (comment)

bluetech and others added 3 commits Jun 28, 2019
The natural expectation is that when a variable is explicitly added to a
module's `__all__`, the module explicitly means to export it.

Previously, this was not the case, and a `from [..] import [..] as [..]`
reexport was required by `--no-implicit-export` even if the variable is
listed in `__all__`.

Fixes #7042
…bled

Currently, in regular files, symbols imported into module A with `from B
import *` are considered explicitly exported from module B as well, i.e.
they are considered part of module's B public API.

This behavior makes sense in stub files as a shorthand (and is specified
in PEP 484), but for regular files I think it is better to be explicit:
add the symbols to `__all__`.

Further discussion:
#7042 (comment)
Copy link
Collaborator

left a comment

Thanks! LGTM.

@ilevkivskyi ilevkivskyi merged commit e9cf4f2 into python:master Aug 19, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.