mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
gh-76785: Add SendChannel.send_buffer() (#110246)
(This is still a test module.)
This commit is contained in:
parent
f4cb0d27cc
commit
7bd560ce8d
13 changed files with 467 additions and 67 deletions
|
@ -225,6 +225,21 @@ class SendChannel(_ChannelEnd):
|
|||
# See bpo-32604 and gh-19829.
|
||||
return _channels.send(self._id, obj)
|
||||
|
||||
def send_buffer(self, obj):
|
||||
"""Send the object's buffer to the channel's receiving end.
|
||||
|
||||
This blocks until the object is received.
|
||||
"""
|
||||
_channels.send_buffer(self._id, obj)
|
||||
|
||||
def send_buffer_nowait(self, obj):
|
||||
"""Send the object's buffer to the channel's receiving end.
|
||||
|
||||
If the object is immediately received then return True
|
||||
(else False). Otherwise this is the same as send().
|
||||
"""
|
||||
return _channels.send_buffer(self._id, obj)
|
||||
|
||||
def close(self):
|
||||
_channels.close(self._id, send=True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue