[Python-checkins] cpython (2.7): issue #9090 : Limit the fix to windows since getting a portable simple

kristjan.jonsson python-checkins at python.org
Tue Mar 19 21:02:01 CET 2013


http://hg.python.org/cpython/rev/f22b93b318a5
changeset:   82768:f22b93b318a5
branch:      2.7
parent:      82764:8ec39bfd1f01
user:        Kristján Valur Jónsson <sweskman at gmail.com>
date:        Tue Mar 19 13:01:05 2013 -0700
summary:
  issue #9090 : Limit the fix to windows since getting a portable simple
time function on non-windows isn't quite simple.

files:
  Modules/socketmodule.c |  21 ++++++++++++++++++++-
  1 files changed, 20 insertions(+), 1 deletions(-)


diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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. */
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list