Fix exceptions if python is built without ipv6 support.

See:
http://bugs.python.org/issue16208
http://bugs.python.org/issue7735