gh-76785: Add SendChannel.send_buffer() (#110246)

(This is still a test module.)
This commit is contained in:
Eric Snow 2023-10-09 07:39:51 -06:00 committed by GitHub
parent f4cb0d27cc
commit 7bd560ce8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 467 additions and 67 deletions

View file

@ -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)