diff options
author | Kristján Valur Jónsson <sweskman@gmail.com> | 2013-03-19 20:01:05 (GMT) |
---|---|---|
committer | Kristján Valur Jónsson <sweskman@gmail.com> | 2013-03-19 20:01:05 (GMT) |
commit | 620e36419aafbb6d5e603bfec7fc9493c3a11b5e (patch) | |
tree | 4e1cfefc32f908e287849c0153149e9ebeb528f4 /Modules/socketmodule.c | |
parent | 6ebc8f3f389ff87b4abec4dd885325303522d8e7 (diff) | |
download | cpython-620e36419aafbb6d5e603bfec7fc9493c3a11b5e.zip cpython-620e36419aafbb6d5e603bfec7fc9493c3a11b5e.tar.gz cpython-620e36419aafbb6d5e603bfec7fc9493c3a11b5e.tar.bz2 |
issue #9090 : Limit the fix to windows since getting a portable simple
time function on non-windows isn't quite simple.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 4aa2db8..76f087b 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -751,6 +751,14 @@ internal_select(PySocketSockObject *s, int writing) } 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 @@ PyAPI_FUNC(double) _PyTime_floattime(void); /* defined in timemodule.c */ 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. */ |