Commit 0e6283e6 authored by Ronald Oussoren's avatar Ronald Oussoren

Ensure that the fix for #17269 also works on OSX 10.4

AI_NUMERICSERV isn't defined on OSX 10.4.
parent 729ad5cf
...@@ -666,7 +666,8 @@ class GeneralModuleTests(unittest.TestCase): ...@@ -666,7 +666,8 @@ class GeneralModuleTests(unittest.TestCase):
socket.AI_PASSIVE) socket.AI_PASSIVE)
# 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 check_sendall_interrupted(self, with_timeout): def check_sendall_interrupted(self, with_timeout):
# socketpair() is not stricly required, but it makes things easier. # socketpair() is not stricly required, but it makes things easier.
......
...@@ -4179,7 +4179,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args) ...@@ -4179,7 +4179,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
"getaddrinfo() argument 2 must be integer or string"); "getaddrinfo() argument 2 must be integer or string");
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".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment