# Issue #6697.
self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
+ # Issue 17269
+ socket.getaddrinfo("localhost", None, 0, 0, 0, socket.AI_NUMERICSERV)
+
def test_getnameinfo(self):
# only IP addresses are allowed
self.assertRaises(socket.error, socket.getnameinfo, ('mail.python.org',0), 0)
- Issue #17968: Fix memory leak in os.listxattr().
+- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X
+ with port None or "0" and flags AI_NUMERICSERV.
+
IDLE
----
PyErr_SetString(PyExc_OSError, "Int or String expected");
goto err;
}
+#ifdef __APPLE__
+ if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) {
+ /* On OSX upto at least OSX 10.8 getaddrinfo crashes
+ * if AI_NUMERICSERV is set and the servname is NULL or "0".
+ * This workaround avoids a segfault in libsystem.
+ */
+ pptr = "00";
+ }
+#endif
memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_socktype = socktype;