[Python-checkins] bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)

miss-islington webhook-mailer at python.org
Tue Feb 1 14:29:58 EST 2022


https://github.com/python/cpython/commit/e4a6e549027b33bbe87f49fcfccc880243e49834
commit: e4a6e549027b33bbe87f49fcfccc880243e49834
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-01T11:29:45-08:00
summary:

bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)


Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 64568acbd88a88d54ac9b8215447f88280448dd5)

Co-authored-by: Emiya <importz750 at gmail.com>

files:
A Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst
M Lib/asyncio/sslproto.py
M Lib/asyncio/transports.py

diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index cad25b26539f5..00fc16c014c9b 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -367,6 +367,12 @@ def get_write_buffer_size(self):
         """Return the current size of the write buffer."""
         return self._ssl_protocol._transport.get_write_buffer_size()
 
+    def get_write_buffer_limits(self):
+        """Get the high and low watermarks for write flow control. 
+        Return a tuple (low, high) where low and high are 
+        positive number of bytes."""
+        return self._ssl_protocol._transport.get_write_buffer_limits()
+
     @property
     def _protocol_paused(self):
         # Required for sendfile fallback pause_writing/resume_writing logic
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py
index 45e155c94cad1..73b1fa2de416c 100644
--- a/Lib/asyncio/transports.py
+++ b/Lib/asyncio/transports.py
@@ -99,6 +99,12 @@ def get_write_buffer_size(self):
         """Return the current size of the write buffer."""
         raise NotImplementedError
 
+    def get_write_buffer_limits(self):
+        """Get the high and low watermarks for write flow control. 
+        Return a tuple (low, high) where low and high are 
+        positive number of bytes."""
+        raise NotImplementedError
+
     def write(self, data):
         """Write some data bytes to the transport.
 
diff --git a/Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst b/Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst
new file mode 100644
index 0000000000000..adbc50a4bf9b7
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst
@@ -0,0 +1 @@
+Add the ``get_write_buffer_limits`` method to :class:`asyncio.transports.WriteTransport` and to the SSL transport.



More information about the Python-checkins mailing list