classification
Title: More incomplete module.__all__ lists
Type: Stage:
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, jayvdb, martin.panter, python-dev, serhiy.storchaka
Priority: normal Keywords:

Created on 2014-08-22 02:42 by martin.panter, last changed 2016-05-10 16:27 by jayvdb. This issue is now closed.

Messages (4)
msg225637 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-08-22 02:42
The nntplib.NNTPError exception is documented, but missing from __all__. I ran across another one the other day, but I can’t remember what it was now.

Is there a practical way to automatically test for some of these, perhaps by scanning the documentation for function and class definitions? These sort of bugs keep popping up, as people adding new features, exceptions, etc, forget to append them to __all__.

Another more radical idea: a decorator something like this might avoid copy-paste errors and make unexported APIs stand out more:

def public(api):
    sys.modules[api.__module__].__all__.append(api.__name__)
    return api

__all__ = list()
@public
def public_function(): ...
@public
class PublicClass: ...

Related:
* Issue 18554: os.__all__
* Issue 22191: warnings.__all__
msg225663 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-22 12:18
Issue 20689: socket.__all__
msg227145 - (view) Author: Roundup Robot (python-dev) Date: 2014-09-20 05:53
New changeset eb9eac80c17a by Berker Peksag in branch '3.4':
Issue #22247: Add NNTPError to nntplib.__all__.
https://hg.python.org/cpython/rev/eb9eac80c17a

New changeset e21b0bbc06ea by Berker Peksag in branch 'default':
Issue #22247: Add NNTPError to nntplib.__all__.
https://hg.python.org/cpython/rev/e21b0bbc06ea
msg228828 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-10-09 02:15
Confirmed Python 3.4.2 fixes the missing NNTPError. I never remembered the other instance I found, so I am happy for this to be closed.
History
Date User Action Args
2016-05-10 16:27:57jayvdbsetnosy: + jayvdb
2014-10-09 05:04:54benjamin.petersonsetstatus: open -> closed
resolution: fixed
2014-10-09 02:15:29martin.pantersetmessages: + msg228828
2014-09-20 05:53:43python-devsetnosy: + python-dev
messages: + msg227145
2014-08-22 12:18:50serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg225663
2014-08-22 10:29:36berker.peksagsetnosy: + berker.peksag
2014-08-22 02:42:48martin.pantercreate