[Python-Dev] Problems with socketmodule (getnameinfo & getaddrinfo)

Tim Peters tim.one@home.com
Sun, 24 Jun 2001 00:48:32 -0400


]Mark Favas]
> Socketmodule at the moment has multiple problems after the changes to
> handle IPv6:
>
> 1:
> socketmodule.c now #includes getnameinfo.c and getaddrinfo.c. These
> functions both use offsetof(), which is defined (on my system, at least)
> in stddef.h. The #include for this file is inside a #if 0 block.
>
> 2:
> #including this file allow the compile to complete without error.
> However, there is no Makefile dependency on these two files, once
> socketmodule.o has been built. Changes to either of the
> get{name,addr}info.c files will not cause socketmodule to be rebuilt.
>
> 3:
> The socket module still does not work, however, since it refers to an
> unresolved symbol inet_pton
> >>> import socket
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File
> "/home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/Li
> b/socket.py",
> line 41, in ?
>     from _socket import *
> ImportError: Unresolved symbol in
> /home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/bui
> ld/lib.osf1-V4.0-alpha-2.2/_socket.so:
> inet_pton
>
> inet_pton is called in two places in getaddrinfo.c... there's likely to
> be other platforms besides Tru64 Unix that do not have this function.

If it's any consolation, the Windows build is in worse shape:

socketmodule.c
Modules\addrinfo.h(123) : error C2632: 'long' followed by 'long' is illegal
Modules\addrinfo.h(125) : error C2632: 'long' followed by 'long' is illegal
Modules\addrinfo.h(129) : error C2632: 'long' followed by 'long' is illegal
Modules\addrinfo.h(129) : error C2632: 'long' followed by 'long' is illegal
Modules\getaddrinfo.c(109) : warning C4013:
    'offsetof' undefined; assuming extern returning int
Modules\getaddrinfo.c(109) : error C2143:
    syntax error : missing ')' before 'type'
Modules\getaddrinfo.c(109) : error C2099: initializer is not a constant
Modules\getaddrinfo.c(109) : error C2059: syntax error : ')'
Modules\getaddrinfo.c(111) : error C2059: syntax error : ','
Modules\getaddrinfo.c(407) : warning C4013:
   'inet_pton' undefined; assuming extern returning int
Modules\getaddrinfo.c(414) : warning C4013:
    'IN_MULTICAST' undefined; assuming extern returning int
Modules\getaddrinfo.c(414) : warning C4013:
    'IN_EXPERIMENTAL' undefined; assuming extern returning int
Modules\getaddrinfo.c(417) : error C2065:
    'IN_LOOPBACKNET' : undeclared identifier
Modules\getaddrinfo.c(417) : warning C4018:
     '==' : signed/unsigned mismatch
Modules\getaddrinfo.c(531) : error C2373:
    'WSAGetLastError' : redefinition; different type modifiers
     C:\VC98\INCLUDE\winsock.h(787) : see declaration of 'WSAGetLastError'
Modules\getnameinfo.c(66) : error C2143:
    syntax error : missing ')' before 'type'
Modules\getnameinfo.c(66) : error C2099: initializer is not a constant
Modules\getnameinfo.c(66) : error C2059: syntax error : ')'
Modules\getnameinfo.c(67) : error C2059: syntax error : ','
Modules\getnameinfo.c(133) : warning C4013:
    'snprintf' undefined; assuming extern returning int
Modules\getnameinfo.c(153) : warning C4018:
    '==' : signed/unsigned mismatch
Modules\getnameinfo.c(167) : warning C4013:
    'inet_ntop' undefined; assuming extern returning int
Modules\getnameinfo.c(168) : warning C4047:
    '==' : 'int ' differs in levels of indirection from 'void *'
Modules\getnameinfo.c(200) : warning C4047:
    '==' : 'int ' differs in levels of indirection from 'void *'

Martin should revert the changes to socketmodule.c until this has a prayer
of working.