diff Modules/socketmodule.c @ 82768:f22b93b318a5 2.7

issue #9090 : Limit the fix to windows since getting a portable simple time function on non-windows isn't quite simple.
author Kristján Valur Jónsson <sweskman@gmail.com>
date Tue, 19 Mar 2013 13:01:05 -0700
parents 8ec39bfd1f01
children 0f5e1e642dc3
line wrap: on
line diff
--- a/Modules/socketmodule.c	Tue Mar 19 10:58:59 2013 -0700
+++ b/Modules/socketmodule.c	Tue Mar 19 13:01:05 2013 -0700
@@ -751,6 +751,14 @@
     }
     END_SELECT_LOOP(s)
 */
+#ifdef _WIN32
+/* _PyTime_floattime is exported from timemodule.c which is a builtin on windows
+ * but not on linux.  The problem we are fixing is mostly a windows problem so
+ * we leave it at that.
+ */
+#define HAVE_PYTIME_FLOATTIME
+#endif
+#ifdef HAVE_PYTIME_FLOATTIME
 PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */
 #define BEGIN_SELECT_LOOP(s) \
     { \
@@ -768,7 +776,18 @@
                 break; \
             interval = deadline - _PyTime_floattime(); \
         } \
-    } \
+    }
+#else
+#define BEGIN_SELECT_LOOP(s) \
+    { \
+        double interval = s->sock_timeout; \
+        do { \
+            errno = 0; \
+
+#define END_SELECT_LOOP(s) \
+        } while(0); \
+    }
+#endif
 
 /* Initialize a new socket object. */