Issue #17269: Workaround for a platform bug in getaddrinfo on OSX

Without this patch socket.getaddrinfo crashed when called
with some unusual argument combinations.