Skip to content

Commit 757cc35

Browse files
gh-84570: Implement Waiting in SendChannel.send() (gh-110565)
We had been faking it (poorly). We will add timeouts separately.
1 parent 46462ff commit 757cc35

File tree

4 files changed

+182
-109
lines changed

4 files changed

+182
-109
lines changed

Lib/test/support/interpreters.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,7 @@ def send(self, obj):
208208
209209
This blocks until the object is received.
210210
"""
211-
_channels.send(self._id, obj)
212-
# XXX We are missing a low-level channel_send_wait().
213-
# See bpo-32604 and gh-19829.
214-
# Until that shows up we fake it:
215-
time.sleep(2)
211+
_channels.send(self._id, obj, blocking=True)
216212

217213
def send_nowait(self, obj):
218214
"""Send the object to the channel's receiving end.
@@ -223,22 +219,22 @@ def send_nowait(self, obj):
223219
# XXX Note that at the moment channel_send() only ever returns
224220
# None. This should be fixed when channel_send_wait() is added.
225221
# See bpo-32604 and gh-19829.
226-
return _channels.send(self._id, obj)
222+
return _channels.send(self._id, obj, blocking=False)
227223

228224
def send_buffer(self, obj):
229225
"""Send the object's buffer to the channel's receiving end.
230226
231227
This blocks until the object is received.
232228
"""
233-
_channels.send_buffer(self._id, obj)
229+
_channels.send_buffer(self._id, obj, blocking=True)
234230

235231
def send_buffer_nowait(self, obj):
236232
"""Send the object's buffer to the channel's receiving end.
237233
238234
If the object is immediately received then return True
239235
(else False). Otherwise this is the same as send().
240236
"""
241-
return _channels.send_buffer(self._id, obj)
237+
return _channels.send_buffer(self._id, obj, blocking=False)
242238

243239
def close(self):
244240
_channels.close(self._id, send=True)

0 commit comments

Comments
 (0)