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.

Title: getaddrinfo emulation does not support AI_NUMERICSERV
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, cheryl.sabella, smejkar
Priority: normal Keywords:

Created on 2017-06-27 10:40 by smejkar, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2437 closed smejkar, 2017-06-27 11:25
Messages (3)
msg297020 - (view) Author: Radek Smejkal (smejkar) * Date: 2017-06-27 10:40
Modules/getaddrinfo.c should support AI_NUMERICSERV.

Moreover, not supporting AI_NUMERICSERV may cause troubles on platforms where the getaddrinfo function is available but it's buggy (see and Modules/socketmodule.c), because Modules/addrinfo.h does not #undef AI_NUMERICSERV and Modules/socketmodule.c exports AI_NUMERICSERV defined in a system header that may collide with another flag defined in Modules/addrinfo.h and confuse the user.

./configure --with-pydebug
Comment out HAVE_GETADDRINFO in pyconfig.h
Comment out ENABLE_IPV6 in pyconfig.h on platforms where getipnodebyname and friends are not available
make -j
Python 3.7.0a0 (default, Jun 27 2017, 11:59:50) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
<AddressInfo.AI_ADDRCONFIG: 1024>
>>> socket.getaddrinfo(None, "http", flags=socket.AI_NUMERICSERV)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/radek/src/github/cpython/Lib/", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 3] invalid value for ai_flags.
msg325323 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-09-14 04:42
What platform needs Modules/getaddrinfo.c these days?
msg344294 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-06-02 16:04
I'm going to close this as the OP hasn't provided a response to Benjamin's question.  It can be re-opened if additional information is provided.  Thanks!
Date User Action Args
2022-04-11 14:58:48adminsetgithub: 74969
2019-06-02 16:04:29cheryl.sabellasetstatus: open -> closed

nosy: + cheryl.sabella
messages: + msg344294

resolution: out of date
stage: resolved
2018-09-14 04:42:57benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg325323
2017-06-27 11:25:59smejkarsetpull_requests: + pull_request2485
2017-06-27 10:40:08smejkarcreate