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

Add getprotobynumber to socket module #68997

Closed
wbooth mannequin opened this issue Aug 6, 2015 · 5 comments
Closed

Add getprotobynumber to socket module #68997

wbooth mannequin opened this issue Aug 6, 2015 · 5 comments
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@wbooth
Copy link
Mannequin

wbooth mannequin commented Aug 6, 2015

BPO 24809
Nosy @vstinner, @1st1, @brianphaley
Files
  • proto.diff
  • 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 2018-07-31.14:27:56.593>
    created_at = <Date 2015-08-06.14:08:39.811>
    labels = ['extension-modules', 'type-feature']
    title = 'Add getprotobynumber to socket module'
    updated_at = <Date 2018-07-31.14:27:56.592>
    user = 'https://bugs.python.org/wbooth'

    bugs.python.org fields:

    activity = <Date 2018-07-31.14:27:56.592>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-07-31.14:27:56.593>
    closer = 'vstinner'
    components = ['Extension Modules']
    creation = <Date 2015-08-06.14:08:39.811>
    creator = 'wbooth'
    dependencies = []
    files = ['40137']
    hgrepos = []
    issue_num = 24809
    keywords = ['patch']
    message_count = 5.0
    messages = ['248128', '248132', '248136', '322686', '322782']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'yselivanov', 'wbooth', 'brianphaley']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue24809'
    versions = ['Python 3.6']

    @wbooth
    Copy link
    Mannequin Author

    wbooth mannequin commented Aug 6, 2015

    Add an old method from netdb to python for a best-effort, centerized look up. For the function to work, /etc/protocols would also need to be present. If the protocol doesn't exist OSError is raised.

    Patch attached.

    @wbooth wbooth mannequin added extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Aug 6, 2015
    @1st1
    Copy link
    Member

    1st1 commented Aug 6, 2015

    What are the use cases?

    If it's "(Rarely used.)" (as docstring indicates), then, perhaps, a package on PyPI is a better solution.

    @wbooth
    Copy link
    Mannequin Author

    wbooth mannequin commented Aug 6, 2015

    Allow users to translate protocol numbers from IPv4/IPv6 headers to a friendly human readable string.

    Just filling a gap in the API. There might be a PyPI package out there similar to socket. However, it's complementary function,'getprotobyname', already exist here. getprotobynumber just flips getprotobyname around.

    @brianphaley
    Copy link
    Mannequin

    brianphaley mannequin commented Jul 30, 2018

    Any chance this will get accepted? I actually have a use case in Openstack where we might get a protocol number and want to save the name along with it. Right now we're looking at using libc getprotoent() directly which isn't that pretty. Thanks!

    @vstinner
    Copy link
    Member

    I concur with Yury that there is not enough users and use cases needing this feature, so it doesn't deserve to pay the maintenance burden in the standard library. Start with a project on PyPI.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants