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

More incomplete module.__all__ lists #66443

Closed
vadmium opened this issue Aug 22, 2014 · 4 comments
Closed

More incomplete module.__all__ lists #66443

vadmium opened this issue Aug 22, 2014 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@vadmium
Copy link
Member

vadmium commented Aug 22, 2014

BPO 22247
Nosy @berkerpeksag, @vadmium, @serhiy-storchaka, @jayvdb

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-10-09.05:04:54.692>
created_at = <Date 2014-08-22.02:42:48.034>
labels = ['library']
title = 'More incomplete module.__all__ lists'
updated_at = <Date 2016-05-10.16:27:57.634>
user = 'https://github.com/vadmium'

bugs.python.org fields:

activity = <Date 2016-05-10.16:27:57.634>
actor = 'jayvdb'
assignee = 'none'
closed = True
closed_date = <Date 2014-10-09.05:04:54.692>
closer = 'benjamin.peterson'
components = ['Library (Lib)']
creation = <Date 2014-08-22.02:42:48.034>
creator = 'martin.panter'
dependencies = []
files = []
hgrepos = []
issue_num = 22247
keywords = []
message_count = 4.0
messages = ['225637', '225663', '227145', '228828']
nosy_count = 5.0
nosy_names = ['python-dev', 'berker.peksag', 'martin.panter', 'serhiy.storchaka', 'jayvdb']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue22247'
versions = ['Python 3.4']

@vadmium
Copy link
Member Author

vadmium commented Aug 22, 2014

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:

@vadmium vadmium added the stdlib Python modules in the Lib dir label Aug 22, 2014
@serhiy-storchaka
Copy link
Member

bpo-20689: socket.__all__

@python-dev
Copy link
Mannequin

python-dev mannequin commented Sep 20, 2014

New changeset eb9eac80c17a by Berker Peksag in branch '3.4':
Issue bpo-22247: Add NNTPError to nntplib.__all__.
https://hg.python.org/cpython/rev/eb9eac80c17a

New changeset e21b0bbc06ea by Berker Peksag in branch 'default':
Issue bpo-22247: Add NNTPError to nntplib.__all__.
https://hg.python.org/cpython/rev/e21b0bbc06ea

@vadmium
Copy link
Member Author

vadmium commented Oct 9, 2014

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

3 participants