Index: Modules/socketmodule.c
===================================================================
--- Modules/socketmodule.c	(revision 62989)
+++ Modules/socketmodule.c	(working copy)
@@ -3952,6 +3952,8 @@
 				"getaddrinfo() argument 1 must be string or None");
 		return NULL;
 	}
+   if ((hptr != NULL)&&(strlen(hptr) == 0))
+      hptr = NULL;
 	if (PyInt_Check(pobj)) {
 		PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj));
 		pptr = pbuf;
@@ -3963,6 +3965,8 @@
 		PyErr_SetString(socket_error, "Int or String expected");
                 goto err;
 	}
+   if ((pptr!=NULL)&&(strlen(pptr) == 0))
+      pptr = (char*)NULL;
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_family = family;
 	hints.ai_socktype = socktype;
