[issue30786] getaddrinfo emulation does not support AI_NUMERICSERV

Radek Smejkal report at bugs.python.org
Tue Jun 27 06:40:08 EDT 2017


New submission from Radek Smejkal:

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 configure.ac 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
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
>>> socket.AI_NUMERICSERV
<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/socket.py", line 743, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 3] invalid value for ai_flags.
>>>

----------
components: Extension Modules
messages: 297020
nosy: smejkar
priority: normal
severity: normal
status: open
title: getaddrinfo emulation does not support AI_NUMERICSERV
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30786>
_______________________________________


More information about the Python-bugs-list mailing list