Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 82776:0f5e1e642dc3 2.7
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.
| author | Kristján Valur Jónsson <sweskman@gmail.com> |
|---|---|
| date | Tue, 19 Mar 2013 13:53:56 -0700 |
| parents | f22b93b318a5 |
| children | f4981d8eb401 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Tue Mar 19 16:26:53 2013 -0400 +++ b/Modules/socketmodule.c Tue Mar 19 13:53:56 2013 -0700 @@ -92,6 +92,7 @@ #include "Python.h" #include "structmember.h" +#include "timefuncs.h" #undef MAX #define MAX(x, y) ((x) < (y) ? (y) : (x)) @@ -751,43 +752,23 @@ } 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. */
