Skip to content

Remove __all__ = ... from stubs#2161

Merged
msullivan merged 2 commits into
masterfrom
ditch_all
May 25, 2018
Merged

Remove __all__ = ... from stubs#2161
msullivan merged 2 commits into
masterfrom
ditch_all

Conversation

@msullivan
Copy link
Copy Markdown
Contributor

The presence of a all causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.

The presence of a __all__ causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.
Copy link
Copy Markdown
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an OK temporary solution, but more globally I would just add the actual lists of names to __all__ in every file.

@msullivan msullivan merged commit 2ba90a6 into master May 25, 2018
@msullivan msullivan deleted the ditch_all branch May 25, 2018 02:00
@gvanrossum
Copy link
Copy Markdown
Member

Actually I think this is wrong. It will break legitimate code that accesses m.__all__ (for whatever reason). The root cause seems to be that if __all__ is present only names it explicitly lists are deemed public. But I think that if __all__ has type Any the assumption should be that anything defined (not imported) should be public (in stubs, non-public values needn't be included at all). We should also still assume that names starting with _ are not public. The rare stub for which this is wrong can fill in its __all__ explicitly.

gwk pushed a commit to gwk/typeshed that referenced this pull request May 29, 2018
The presence of a __all__ causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
The presence of a __all__ causes everything to not get picked up by
import *, which among other things breaks the new six.moves stubs.
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.

3 participants