Title: warnings.__all__ incomplete
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, jon.poler, ncoghlan, pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords: easy, patch

Created on 2014-08-13 13:42 by pitrou, last changed 2014-08-23 14:01 by jon.poler. This issue is now closed.

File name Uploaded Description Edit
warnings.__all__.patch jon.poler, 2014-08-16 00:00 review
Messages (12)
msg225279 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-13 13:42
If you try `pydoc warnings` (or `help(warnings)` in the interpreter prompt) you'll notice that some functions such as simplefilter() don't appear. This seems to be because warnings.__all__ is incomplete.
msg225285 - (view) Author: Jon Poler (jon.poler) * Date: 2014-08-13 19:15

I'll look in to this unless you want do so yourself.

msg225286 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-13 20:05
Jon, please do!
msg225293 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-14 10:02
See also issue20689. socket.__all__ is incomplete too.
msg225296 - (view) Author: Jon Poler (jon.poler) * Date: 2014-08-14 12:57
Serhiy, should I submit these fixes as separate patches? E.g. one patch for the warnings module, and another for the socket module?

More generally, should the items included in __all__ be derived from the items described in the documentation? For instance, only the functions listed in 18.1.2 ?

And finally, should a unittest be added for both of these modules to ensure that __all__ includes all of the desired publicly exposed elements?
msg225299 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-08-14 14:05
Yes, please use separate patches attached to the appropriate bug. As for what should go into __all__, it's what is documented as the API of the module. As for tests, it doesn't hurt. =)
msg225375 - (view) Author: Jon Poler (jon.poler) * Date: 2014-08-16 00:00
Here is a patch that changes __all__ in Lib/ to include the functions mentioned in the library reference A unittest is included.

This is my first patch, so comments/feedback are welcome (from now on, I should probably add).
msg225667 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-08-22 14:37
The patch looks good, Jon! I'm running the test suite now to make sure nothing odd happens from the change, but barring that this should be committed in Python 3.4 and default shortly.
msg225668 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-08-22 14:37
And Python 2.7.
msg225670 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-22 14:46
New changeset a77dc87a34ff by Brett Cannon in branch '3.4':
Issue #22191: Fix warnings.__all__.

New changeset aeb5fc7a9956 by Brett Cannon in branch 'default':
Merge for issue #22191 fix
msg225672 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-22 14:50
New changeset 727fd4ead3fd by Brett Cannon in branch '2.7':
Issue #22191: Fix warnings.__all__.
msg225749 - (view) Author: Jon Poler (jon.poler) * Date: 2014-08-23 14:01
Thanks, Brett!
Date User Action Args
2014-08-23 14:01:24jon.polersetmessages: + msg225749
2014-08-22 14:51:16brett.cannonsetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2014-08-22 14:50:54python-devsetmessages: + msg225672
2014-08-22 14:46:18python-devsetnosy: + python-dev
messages: + msg225670
2014-08-22 14:37:39brett.cannonsetstatus: pending -> open

messages: + msg225668
2014-08-22 14:37:23brett.cannonsetstatus: open -> pending

messages: + msg225667
stage: commit review
2014-08-16 14:21:10brett.cannonsetassignee: brett.cannon
2014-08-16 00:00:06jon.polersetfiles: + warnings.__all__.patch
keywords: + patch
messages: + msg225375
2014-08-14 14:05:56brett.cannonsetmessages: + msg225299
2014-08-14 12:57:48jon.polersetmessages: + msg225296
2014-08-14 10:02:10serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg225293
2014-08-13 20:05:47pitrousetmessages: + msg225286
2014-08-13 19:15:36jon.polersetnosy: + jon.poler
messages: + msg225285
2014-08-13 13:42:16pitroucreate