Skip to content

Commit 7608b60

Browse files
committed
Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
docstrings and ValueError messages. Patch by Zhongyue Luo
1 parent a594c63 commit 7608b60

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Lib/queue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def put(self, item, block=True, timeout=None):
120120
121121
If optional args 'block' is true and 'timeout' is None (the default),
122122
block if necessary until a free slot is available. If 'timeout' is
123-
a positive number, it blocks at most 'timeout' seconds and raises
123+
a non-negative number, it blocks at most 'timeout' seconds and raises
124124
the Full exception if no free slot was available within that time.
125125
Otherwise ('block' is false), put an item on the queue if a free slot
126126
is immediately available, else raise the Full exception ('timeout'
@@ -135,7 +135,7 @@ def put(self, item, block=True, timeout=None):
135135
while self._qsize() >= self.maxsize:
136136
self.not_full.wait()
137137
elif timeout < 0:
138-
raise ValueError("'timeout' must be a positive number")
138+
raise ValueError("'timeout' must be a non-negative number")
139139
else:
140140
endtime = time() + timeout
141141
while self._qsize() >= self.maxsize:
@@ -152,7 +152,7 @@ def get(self, block=True, timeout=None):
152152
153153
If optional args 'block' is true and 'timeout' is None (the default),
154154
block if necessary until an item is available. If 'timeout' is
155-
a positive number, it blocks at most 'timeout' seconds and raises
155+
a non-negative number, it blocks at most 'timeout' seconds and raises
156156
the Empty exception if no item was available within that time.
157157
Otherwise ('block' is false), return an item if one is immediately
158158
available, else raise the Empty exception ('timeout' is ignored
@@ -166,7 +166,7 @@ def get(self, block=True, timeout=None):
166166
while not self._qsize():
167167
self.not_empty.wait()
168168
elif timeout < 0:
169-
raise ValueError("'timeout' must be a positive number")
169+
raise ValueError("'timeout' must be a non-negative number")
170170
else:
171171
endtime = time() + timeout
172172
while not self._qsize():

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ Ray Loyzaga
753753
Lukas Lueg
754754
Loren Luke
755755
Fredrik Lundh
756+
Zhongyue Luo
756757
Mark Lutz
757758
Jim Lynch
758759
Mikael Lyngvig

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Core and Builtins
6464
Library
6565
-------
6666

67+
- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
68+
docstrings and ValueError messages. Patch by Zhongyue Luo
69+
6770
- Issue #18681: Fix a NameError in imp.reload() (noticed by Weizhao Li).
6871

6972
- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error

0 commit comments

Comments
 (0)