mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
* selectmodule.c (select_select): timeout argument may be None with same
meaning as no 4th argument
This commit is contained in:
parent
82d410e733
commit
c7a22703e7
1 changed files with 12 additions and 6 deletions
|
|
@ -114,7 +114,7 @@ select_select(self, args)
|
||||||
{
|
{
|
||||||
object *fd2obj[FD_SETSIZE];
|
object *fd2obj[FD_SETSIZE];
|
||||||
object *ifdlist, *ofdlist, *efdlist;
|
object *ifdlist, *ofdlist, *efdlist;
|
||||||
object *ret;
|
object *ret, *tout;
|
||||||
fd_set ifdset, ofdset, efdset;
|
fd_set ifdset, ofdset, efdset;
|
||||||
double timeout;
|
double timeout;
|
||||||
struct timeval tv, *tvp;
|
struct timeval tv, *tvp;
|
||||||
|
|
@ -124,12 +124,18 @@ select_select(self, args)
|
||||||
|
|
||||||
|
|
||||||
/* Get args. Looks funny because of optional timeout argument */
|
/* 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;
|
seconds = (int)timeout;
|
||||||
|
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;
|
timeout = timeout - (double)seconds;
|
||||||
tv.tv_sec = seconds;
|
tv.tv_sec = seconds;
|
||||||
tv.tv_usec = (int)(timeout*1000000.0);
|
tv.tv_usec = (int)(timeout*1000000.0);
|
||||||
tvp = &tv;
|
tvp = &tv;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Doesn't have 4 args, that means no timeout */
|
/* Doesn't have 4 args, that means no timeout */
|
||||||
err_clear();
|
err_clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue