STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Tim Lesher on python-dev: "On the Windows side, Sleep(-1) as "infinite" is 
correct and documented:
http://msdn.microsoft.com/en-us/library/ms686298(v=vs.85).aspx"

Wine defines INFINITE using "#define INFINITE 0xFFFFFFFF":
http://source.winehq.org/source/include/winbase.h

-1 becomes INFINITE because of an integer overflow (because of a cast from 
double to *unsigned* long). time.sleep(-2) doesn't sleep for an infinite time, 
but for more than 136 years (maybe more in 64 bits?):

>>> print(datetime.timedelta(seconds=-2 & 0xFFFFFFFF))
49710 days, 6:28:14

What is the usecase of Sleep(INFINITE)? Wait a signal or wait another event?

Because other platforms don't support the INFINITE timeout, I suggest to always 
raise an error to have the same behaviour on all platforms. 

On POSIX, you can use pause(), sigwait(), select() or other functions to wait a 
signal for example. If we something something like that on Windows, we need a 
new function, but not a magic time.sleep(-1) please.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12459>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to