[New-bugs-announce] [issue18676] Queue: zero should not be accepted as timeout value

Zhongyue Luo report at bugs.python.org
Wed Aug 7 15:52:08 CEST 2013


New submission from Zhongyue Luo:

The docstring of methods put() and get() in Queue.py states

get(): If 'timeout' is a positive number, it blocks at most 'timeout' seconds and raises the Full exception if no free slot was available within that time.

put(): If 'timeout' is a positive number, it blocks at most 'timeout' seconds and raises the Empty exception if no item was available within that time.

Additionally the ValueError both methods raise is

 raise ValueError("'timeout' must be a positive number")

However the logic checks if 'timeout' is non-negative.

 elif timeout < 0:
     raise ValueError("'timeout' must be a positive number")

The logic should change as

 elif timeout <= 0:
     raise ValueError("'timeout' must be a positive number")

----------
components: Library (Lib)
messages: 194611
nosy: zyluo
priority: normal
severity: normal
status: open
title: Queue: zero should not be accepted as timeout value
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18676>
_______________________________________


More information about the New-bugs-announce mailing list