classification
Title: Possibly incorrect example is given for socket.getaddrinfo()
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Alexander.Patrakov, docs@python, python-dev
Priority: normal Keywords:

Created on 2014-08-22 11:43 by Alexander.Patrakov, last changed 2014-10-28 21:47 by python-dev. This issue is now closed.

Messages (3)
msg225659 - (view) Author: Alexander Patrakov (Alexander.Patrakov) Date: 2014-08-22 11:43
See the example at https://docs.python.org/2/library/socket.html#socket.getaddrinfo

>>> socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)

As I am primarily a C programmer, it is quite surprising for me to see a SOL_* being passed into the proto argument. I thought that SOL_* is only for setsockopt(), and IPPROTO_* would be suitable. Yes, for TCP and UDP the SOL_* and IPPROTO_* constants are the same, but see e.g. http://msdn.microsoft.com/en-us/library/windows/desktop/ms737530%28v=vs.85%29.aspx which specifically points out that IPPROTO_* constants as acceptable values.
msg230178 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-28 21:46
New changeset 5611c7c20460 by Georg Brandl in branch '3.4':
Closes #22249: use IPPROTO_TCP constant instead of SOL_TCP constant for getaddrinfo() proto param
https://hg.python.org/cpython/rev/5611c7c20460
msg230179 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-28 21:47
New changeset 999e72ed3fbc by Georg Brandl in branch '2.7':
Closes #22249: use IPPROTO_TCP constant instead of SOL_TCP constant for getaddrinfo() proto param
https://hg.python.org/cpython/rev/999e72ed3fbc
History
Date User Action Args
2014-10-28 21:47:33python-devsetmessages: + msg230179
2014-10-28 21:46:14python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg230178

resolution: fixed
stage: resolved
2014-08-22 11:43:28Alexander.Patrakovcreate