summaryrefslogtreecommitdiffstats
path: root/Lib/test/support/interpreters.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-10-09 13:39:51 (GMT)
committerGitHub <noreply@github.com>2023-10-09 13:39:51 (GMT)
commit7bd560ce8de41e62230975c44fd7fbd189e8e858 (patch)
tree0d58bd28ecb0827591cf0c91a0a3cefc1de1926c /Lib/test/support/interpreters.py
parentf4cb0d27cc08f490c42a22e646eb73cc7072d54a (diff)
downloadcpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.zip
cpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.tar.gz
cpython-7bd560ce8de41e62230975c44fd7fbd189e8e858.tar.bz2
gh-76785: Add SendChannel.send_buffer() (#110246)
(This is still a test module.)
Diffstat (limited to 'Lib/test/support/interpreters.py')
-rw-r--r--Lib/test/support/interpreters.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/support/interpreters.py b/Lib/test/support/interpreters.py
index 5aba369..d61724c 100644
--- a/Lib/test/support/interpreters.py
+++ b/Lib/test/support/interpreters.py
@@ -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)