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

Mark Favas m.favas@per.dem.csiro.au
Mon, 25 Jun 2001 06:16:25 +0800

[Martin v. Loewis]
> > 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.
> That should be fixed now. stddef.h is included in socketmodule.c; if
> it is not available or does not define offsetof, an additional
> definition is provided.

Yes, this is fine now...

> > 2. [...] Changes to either of the get{name,addr}info.c files will
> > not cause socketmodule to be rebuilt.
> I don't know how to solve this one. If distutils builds the modules,
> makefile dependencies won't help.
> > 3. The socket module still does not work, however, since it refers
> > to an unresolved symbol inet_pton
> I took the simplest solution that I could think of, delegating
> inet_{pton,ntop} to inet_{ntoa,addr} for AF_INET, failing for all
> other address families (AF_INET6 in particular). I've verified that
> this code does the same as the builtin functions on my Linux system;
> please let me know whether it compiles for you.

To get socketmodule.c to compile, I had to make a change to line 2963 
so that the declaration of inet_pton matched the previous declaration on
line 220 (changing char *src to const char *src). Still have problems
though, due to the use of snprintf in getnameinfo.c:

Python 2.2a0 (#444, Jun 25 2001, 05:58:17) [C] on osf1V4
Type "copyright", "credits" or "license" for more information.
>>> import socket
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
line 41, in ?
    from _socket import *
ImportError: Unresolved symbol in

Mark Favas  -   m.favas@per.dem.csiro.au
CSIRO, Private Bag No 5, Wembley, Western Australia 6913, AUSTRALIA