[Python-Dev] Recent experiences with socket.inet_aton, socket.inet_{ntop,pton}
Martin v. Löwis
martin@v.loewis.de
20 Jul 2003 23:31:17 +0200
Bob Halley <halley@play-bow.org> writes:
> A good implementation must also detect and reject all of the invalid
> cases, such as improper use of the "::" zero compression syntax.
In that case, I think we should drop the inet_ntop wrapper from
socketmodule.c, and provide a pure-Python implementation in
socket.py. I know for fact that some platforms don't support AF_INET6
at all, but still provide inet_pton, hence all the #ifdef dances in
that function.
So if you need guarantees about its behaviour, you have to implement
it yourself.
Contributions in this direction are welcome; as Aahz points out, they
cannot have effect before 2.4. Make sure you provide plenty of test
cases, too.
Regards,
Martin