mirror of https://github.com/python/cpython.git
(3.3->default) Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
This commit is contained in:
commit
36451f076b
|
@ -1202,7 +1202,8 @@ def testGetaddrinfo(self):
|
||||||
self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
|
self.assertRaises(UnicodeEncodeError, socket.getaddrinfo, 'localhost', '\uD800')
|
||||||
|
|
||||||
# Issue 17269
|
# Issue 17269
|
||||||
socket.getaddrinfo("localhost", None, 0, 0, 0, socket.AI_NUMERICSERV)
|
if hasattr(socket, 'AI_NUMERICSERV'):
|
||||||
|
socket.getaddrinfo("localhost", None, 0, 0, 0, socket.AI_NUMERICSERV)
|
||||||
|
|
||||||
def test_getnameinfo(self):
|
def test_getnameinfo(self):
|
||||||
# only IP addresses are allowed
|
# only IP addresses are allowed
|
||||||
|
|
|
@ -4975,7 +4975,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
|
||||||
PyErr_SetString(PyExc_OSError, "Int or String expected");
|
PyErr_SetString(PyExc_OSError, "Int or String expected");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) && defined(AI_NUMERICSERV)
|
||||||
if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) {
|
if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) {
|
||||||
/* On OSX upto at least OSX 10.8 getaddrinfo crashes
|
/* On OSX upto at least OSX 10.8 getaddrinfo crashes
|
||||||
* if AI_NUMERICSERV is set and the servname is NULL or "0".
|
* if AI_NUMERICSERV is set and the servname is NULL or "0".
|
||||||
|
|
Loading…
Reference in New Issue