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.

Author cheryl.sabella
Recipients cheryl.sabella, eric.smith, exarkun, flox, flub, giampaolo.rodola, pitrou, vstinner
Date 2018-01-27.18:31:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517077882.6.0.467229070634.issue8881@psf.upfronthosting.co.za>
In-reply-to
Content
This one looks to be partly done due to #18720 and enums.

>>> for item in socket.getaddrinfo(None, 0):
...     print(item)
... 
(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_RAW: 3>, 0, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('127.0.0.1', 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_RAW: 3>, 0, '', ('127.0.0.1', 0))

Is there a reason that Protocols weren't converted to be enums?  I added quick code to socket.py and it turned the above into:

(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, <Protocol.IPPROTO_TCP: 6>, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_DGRAM: 2>, <Protocol.IPPROTO_UDP: 17>, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_RAW: 3>, <Protocol.IPPROTO_HOPOPTS: 0>, '', ('::1', 0, 0, 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, <Protocol.IPPROTO_TCP: 6>, '', ('127.0.0.1', 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, <Protocol.IPPROTO_UDP: 17>, '', ('127.0.0.1', 0))
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_RAW: 3>, <Protocol.IPPROTO_HOPOPTS: 0>, '', ('127.0.0.1', 0))

Would that be a responsible change to include?
History
Date User Action Args
2018-01-27 18:31:22cheryl.sabellasetrecipients: + cheryl.sabella, exarkun, pitrou, vstinner, eric.smith, giampaolo.rodola, flub, flox
2018-01-27 18:31:22cheryl.sabellasetmessageid: <1517077882.6.0.467229070634.issue8881@psf.upfronthosting.co.za>
2018-01-27 18:31:22cheryl.sabellalinkissue8881 messages
2018-01-27 18:31:22cheryl.sabellacreate