]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Ensure that the fix for #17269 also works on OSX 10.4
authorRonald Oussoren <ronaldoussoren@mac.com>
Mon, 10 Jun 2013 08:35:36 +0000 (10:35 +0200)
committerRonald Oussoren <ronaldoussoren@mac.com>
Mon, 10 Jun 2013 08:35:36 +0000 (10:35 +0200)
AI_NUMERICSERV isn't defined on OSX 10.4.

Lib/test/test_socket.py
Modules/socketmodule.c

index 3b112e68384ac115e2b1a85c613442ea33afd961..6e7218034d9c38813613cc3291e16fe5fea40687 100644 (file)
@@ -666,7 +666,8 @@ class GeneralModuleTests(unittest.TestCase):
                            socket.AI_PASSIVE)
 
         # 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):
         # socketpair() is not stricly required, but it makes things easier.
index 238c849b8459e45bc01a136ff0ac59d8a6d2da80..2735ecc77359f4deafd3e2cd38d491cd18aab231 100644 (file)
@@ -4179,7 +4179,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
                         "getaddrinfo() argument 2 must be integer or string");
         goto err;
     }
-#ifdef __APPLE__
+#if defined(__APPLE__) && defined(AI_NUMERICSERV)
     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".