Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9dbb33

Browse filesBrowse files
committed
Move some tests about shutdwon state and empty queue
1 parent aad0cba commit d9dbb33
Copy full SHA for d9dbb33

File tree

Expand file treeCollapse file tree

1 file changed

+4
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-9
lines changed

‎Lib/multiprocessing/queues.py

Copy file name to clipboardExpand all lines: Lib/multiprocessing/queues.py
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,29 +113,24 @@ def get(self, block=True, timeout=None):
113113
if self._shutdown_state.value == _queue_shutdown_immediate:
114114
raise ShutDown
115115
if block and timeout is None:
116+
if self._shutdown_state.value == _queue_shutdown and self.empty():
117+
raise ShutDown
116118
with self._rlock:
117-
if self._shutdown_state.value == _queue_shutdown_immediate or\
118-
(self._shutdown_state.value == _queue_shutdown and self.empty()):
119-
raise ShutDown
120119
res = self._recv_bytes()
121120
self._sem.release()
122121
else:
123122
if block:
124123
deadline = time.monotonic() + timeout
124+
if self._shutdown_state.value == _queue_shutdown and self.empty():
125+
raise ShutDown
125126
if not self._rlock.acquire(block, timeout):
126-
if self._shutdown_state.value == _queue_shutdown:
127-
raise ShutDown
128127
raise Empty
129128
try:
130129
if block:
131130
timeout = deadline - time.monotonic()
132131
if not self._poll(timeout):
133-
if self._shutdown_state.value == _queue_shutdown:
134-
raise ShutDown
135132
raise Empty
136133
elif not self._poll():
137-
if self._shutdown_state.value == _queue_shutdown:
138-
raise ShutDown
139134
raise Empty
140135
res = self._recv_bytes()
141136
self._sem.release()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.