@andreas blobs are a bit beyond my skill set but ai=socket.getaddrinfo(host, 443) is using a socket so I reckon a 5s OSError socket timeout should prevent hangs if someone can figure out how to change the default timeout & recompile.
My thread attempt was pretty simple, put getaddrinfo in a thread, wait for 5s in the main program then move on if the thread had not produced a DNS by then. Instead the main program stalled after 1 iteration of the 5s delay loop and waited for the thread.