Message196960
Here from the 3.3.2 docs for threading.Lock:
"""
acquire(blocking=True, timeout=-1)
Acquire a lock, blocking or non-blocking.
...
When invoked with the floating-point timeout argument set to a positive value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. A negative timeout argument specifies an unbounded wait.
...
"""
However, that's not what the code does for a negative timeout:
>>> from threading import Lock
>>> x = Lock()
>>> x.acquire(1, -0.2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: timeout value must be strictly positive
The only negative value the code allows is -1, in lock_PyThread_acquire_lock():
if (timeout < 0 && timeout != -1) {
PyErr_SetString(PyExc_ValueError, "timeout value must be "
"strictly positive");
return NULL;
}
The docs should change to say that -1 is special ;-) |
|
Date |
User |
Action |
Args |
2013-09-04 21:54:08 | tim.peters | set | recipients:
+ tim.peters, docs@python |
2013-09-04 21:54:08 | tim.peters | set | messageid: <1378331648.69.0.879815072803.issue18927@psf.upfronthosting.co.za> |
2013-09-04 21:54:08 | tim.peters | link | issue18927 messages |
2013-09-04 21:54:08 | tim.peters | create | |
|