The problem is that the library patches (httplib, ftplib, etc) do use getaddrinfo to find out how to contact a remote system, which is the right thing to do IMO. So even if the IPv6 support can be activated only if desired, getaddrinfo absolutely has to work.
Yes, but in an IPv4-only environment it would be super trivial to implement, right?
Right, and getaddrinfo.c/getnameinfo.c attempt such an implementation. They might attempt to get it "more right" than necessary, but still they are "pure C", in the sense that they don't rely on any libraries except for those available in a typical IPv4 sockets implementation.
At least that's the theory. It turns out that they've been using inet_pton and snprintf, which is probably because they have been mainly tested on BSD. I'm in good faith that we can reduce them to a "no funny library calls needed" minimum. If somebody wants to implement them anew from ground up, only using what the socketmodule already uses, that would be fine as well. An actual review for the code for portability problems would also be helpful.