Message139548
For reference, see the thread on the users' mailinglist/newsgroup from 2011-06-29 "how to call a function for evry 10 seconds" and the thread on the developers' mailinglist from 2011-06-30 "time.sleep(-1) behaviour".
The problem is how negative arguments to time.sleep() are handled. Python 2.x (tested 2.5 and 2.7) implementations on MS Windows seems to have a 32-bit underflow while converting the given argument to the DWORD that is passed to win32's Sleep() function. This causes a small negative value to sleep for a long time.
On Linux, using Python 2.6, you get an IOError instead. While an error is better than blocking effectively forever, the use of an IOError to signal the wrong argument is at least confusing. I guess it is an artifact of the implementation, but that shouldn't be visible prominently.
IMHH, both versions should raise a ValueError to signal invalid arguments. However, there was also the suggestion to simply treat negative values as zero, after all time.sleep() is already documented to possibly sleep longer than specified. |
|
Date |
User |
Action |
Args |
2011-07-01 06:45:51 | eckhardt | set | recipients:
+ eckhardt |
2011-07-01 06:45:50 | eckhardt | set | messageid: <1309502750.92.0.889855315847.issue12459@psf.upfronthosting.co.za> |
2011-07-01 06:45:50 | eckhardt | link | issue12459 messages |
2011-07-01 06:45:49 | eckhardt | create | |
|