summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorKristján Valur Jónsson <sweskman@gmail.com>2013-03-19 20:53:56 (GMT)
committerKristján Valur Jónsson <sweskman@gmail.com>2013-03-19 20:53:56 (GMT)
commit868f0aac37cf6c879471c3b8e65e6db623460ce5 (patch)
tree8f2aeef3f42d43d3b6fcc3f3f198ab80c27bd97c /Modules
parenta39c47aab0ec3032e25e8b0783616d50905ea9e2 (diff)
downloadcpython-868f0aac37cf6c879471c3b8e65e6db623460ce5.zip
cpython-868f0aac37cf6c879471c3b8e65e6db623460ce5.tar.gz
cpython-868f0aac37cf6c879471c3b8e65e6db623460ce5.tar.bz2
issue #9090 : Take the same approach for socketmodule as daytimemodule
when it needs support from timemodule (which is a .so on linux): link in timemodule.c for the required functions.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c27
-rw-r--r--Modules/timemodule.c2
2 files changed, 5 insertions, 24 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 76f087b..bdc055d 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -92,6 +92,7 @@ Local naming conventions:
#include "Python.h"
#include "structmember.h"
+#include "timefuncs.h"
#undef MAX
#define MAX(x, y) ((x) < (y) ? (y) : (x))
@@ -751,43 +752,23 @@ 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) \
{ \
double deadline, interval = s->sock_timeout; \
int has_timeout = s->sock_timeout > 0.0; \
if (has_timeout) { \
- deadline = _PyTime_floattime() + s->sock_timeout; \
+ deadline = _PyTime_FloatTime() + s->sock_timeout; \
} \
while (1) { \
- errno = 0; \
+ errno = 0;
#define END_SELECT_LOOP(s) \
if (!has_timeout || \
(!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \
break; \
- interval = deadline - _PyTime_floattime(); \
+ 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. */
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index c87805f..12c43b0 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1058,7 +1058,7 @@ floatsleep(double secs)
/* export floattime to socketmodule.c */
PyAPI_FUNC(double)
-_PyTime_floattime(void)
+_PyTime_FloatTime(void)
{
return floattime();
}