summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-11-01 16:27:16 (GMT)
committerGuido van Rossum <guido@python.org>1993-11-01 16:27:16 (GMT)
commitc7a22703e71f6074818e4661b0bbb57bbd726af7 (patch)
tree07a8345f7b40e5df943a5e0def2540530b3067bd /Modules/selectmodule.c
parent82d410e73301f22a2e48c884d826eb772b1e89ef (diff)
downloadcpython-c7a22703e71f6074818e4661b0bbb57bbd726af7.zip
cpython-c7a22703e71f6074818e4661b0bbb57bbd726af7.tar.gz
cpython-c7a22703e71f6074818e4661b0bbb57bbd726af7.tar.bz2
* selectmodule.c (select_select): timeout argument may be None with same
meaning as no 4th argument
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 81fedd5..77ea61c 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -114,7 +114,7 @@ select_select(self, args)
{
object *fd2obj[FD_SETSIZE];
object *ifdlist, *ofdlist, *efdlist;
- object *ret;
+ object *ret, *tout;
fd_set ifdset, ofdset, efdset;
double timeout;
struct timeval tv, *tvp;
@@ -124,12 +124,18 @@ select_select(self, args)
/* Get args. Looks funny because of optional timeout argument */
- if ( getargs(args, "(OOOd)", &ifdlist, &ofdlist, &efdlist, &timeout) ) {
+ if ( getargs(args, "(OOOO)", &ifdlist, &ofdlist, &efdlist, &tout) ) {
seconds = (int)timeout;
- timeout = timeout - (double)seconds;
- tv.tv_sec = seconds;
- tv.tv_usec = (int)(timeout*1000000.0);
- tvp = &tv;
+ if (tout == None)
+ tvp = (struct timeval *)0;
+ else {
+ if (!getargs(tout, "%d;timeout must be float or None", &timeout))
+ return NULL;
+ timeout = timeout - (double)seconds;
+ tv.tv_sec = seconds;
+ tv.tv_usec = (int)(timeout*1000000.0);
+ tvp = &tv;
+ }
} else {
/* Doesn't have 4 args, that means no timeout */
err_clear();