Skip to content

Commit 1b7863c

Browse files
vstinnergrzgrzgrz3
andauthored
bpo-30595: Fix multiprocessing.Queue.get(timeout) (python#2027)
multiprocessing.Queue.get() with a timeout now polls its reader in non-blocking mode if it succeeded to aquire the lock but the acquire took longer than the timeout. Co-Authored-By: Grzegorz Grzywacz <[email protected]>
1 parent 5f31d5c commit 1b7863c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/multiprocessing/queues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get(self, block=True, timeout=None):
101101
try:
102102
if block:
103103
timeout = deadline - time.time()
104-
if timeout < 0 or not self._poll(timeout):
104+
if not self._poll(timeout):
105105
raise Empty
106106
elif not self._poll():
107107
raise Empty

Misc/NEWS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,14 @@ Extension Modules
350350
Library
351351
-------
352352

353+
- bpo-30595: multiprocessing.Queue.get() with a timeout now polls its reader in
354+
non-blocking mode if it succeeded to aquire the lock but the acquire took
355+
longer than the timeout.
356+
353357
- bpo-30605: re.compile() no longer raises a BytesWarning when compiling a
354358
bytes instance with misplaced inline modifier. Patch by Roy Williams.
355359

356-
- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl
360+
- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl
357361
implementation. Patch by Michaël Sghaïer.
358362

359363
- bpo-29743: Closing transport during handshake process leaks open socket.

0 commit comments

Comments
 (0)