This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add getprotobynumber to socket module
Type: enhancement Stage: resolved
Components: Extension Modules Versions: Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: brianphaley, vstinner, wbooth, yselivanov
Priority: normal Keywords: patch

Created on 2015-08-06 14:08 by wbooth, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
proto.diff wbooth, 2015-08-06 14:08
Messages (5)
msg248128 - (view) Author: Will Booth (wbooth) * Date: 2015-08-06 14:08
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.
msg248132 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-08-06 15:51
What are the use cases?

If it's "(Rarely used.)" (as docstring indicates), then, perhaps, a package on PyPI is a better solution.
msg248136 - (view) Author: Will Booth (wbooth) * Date: 2015-08-06 17:12
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.
msg322686 - (view) Author: Brian Haley (brianphaley) Date: 2018-07-30 19:51
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!
msg322782 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-31 14:27
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.
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68997
2018-07-31 14:27:56vstinnersetstatus: open -> closed
resolution: rejected
messages: + msg322782

stage: resolved
2018-07-30 19:51:21brianphaleysetnosy: + brianphaley
messages: + msg322686
2015-08-06 17:12:49wboothsetmessages: + msg248136
2015-08-06 15:51:34yselivanovsetnosy: + vstinner, yselivanov

messages: + msg248132
versions: + Python 3.6, - Python 3.5
2015-08-06 14:42:48wboothsetversions: + Python 3.5, - Python 3.6
2015-08-06 14:08:39wboothcreate