This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `_SSLProtocolTransport` doesn't have the `get_write_buffer_limits` implementation.
Type: enhancement Stage: resolved
Components: asyncio Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, miss-islington, mooncell07, yselivanov
Priority: normal Keywords: patch

Created on 2022-01-23 16:49 by mooncell07, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30958 merged mooncell07, 2022-01-27 12:20
PR 31055 merged miss-islington, 2022-02-01 16:05
PR 31056 merged miss-islington, 2022-02-01 16:05
Messages (9)
msg411382 - (view) Author: Nova (mooncell07) * Date: 2022-01-23 16:49
When calling `get_write_buffer_limits` on a SSL transport the following exception is raised:

```py
Traceback (most recent call last):
  File "/home/mooncell/works/test.py", line 26, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/home/mooncell/works/test.py", line 24, in main
    print(transport.get_write_buffer_limits())
  File "/usr/lib/python3.10/asyncio/transports.py", line 306, in get_write_buffer_limits
    return (self._low_water, self._high_water)
AttributeError: '_SSLProtocolTransport' object has no attribute '_low_water'. Did you mean: '_high_water'?
```

We looked into the implementation and found out that `_SSLProtocolTransport` didn't override the `_FlowControlMixin.get_write_buffer_limits`.
msg411777 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-26 17:03
Technically it should not provide the method according to the current design.
get_write_buffer_limits() is not a part of public transports API, this method is defined by private class _FlowControlMixin only.

WriteTransport requires only get_write_buffer_size() and set_write_buffer_limits() *setter* but not get_write_buffer_limits() getter.

I agree, looks weird.
The best solution maybe is adding get_write_buffer_limits() to WriteTransport definition and documenting the change.

Would you prepare a pull request? I'm happy to review/merge it.
msg411778 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-26 17:04
Forgot to write, after making the method public we can implement it in SSL transport easily.
msg411788 - (view) Author: Nova (mooncell07) * Date: 2022-01-26 19:35
Hey Andrew, thanks for the reply! 

> Would you prepare a pull request?

Sure.

> ... and documenting the change.

Apparently `WriteTransport.get_write_buffer_limits` is already documented 
(https://docs.python.org/3/library/asyncio-protocol.html#asyncio.WriteTransport.get_write_buffer_limits) 

so please can you clarify on what did you mean by that? 

I am sorry this is my first time here.
msg411843 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-01-27 08:22
Sorry, I didn't look into docs before writing.
Now we have an interesting situation: the documentation reflects the desired state already but the code is not :)

The PR should contain fixes for transports.py and sslproto.py only (plus a blurb record for NEWs).

Sorry for misleading you.
msg412285 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-02-01 16:05
New changeset 64568acbd88a88d54ac9b8215447f88280448dd5 by Emiya in branch 'main':
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)
https://github.com/python/cpython/commit/64568acbd88a88d54ac9b8215447f88280448dd5
msg412299 - (view) Author: miss-islington (miss-islington) Date: 2022-02-01 19:29
New changeset e4a6e549027b33bbe87f49fcfccc880243e49834 by Miss Islington (bot) in branch '3.9':
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)
https://github.com/python/cpython/commit/e4a6e549027b33bbe87f49fcfccc880243e49834
msg412300 - (view) Author: miss-islington (miss-islington) Date: 2022-02-01 19:30
New changeset e5e1441d41907f92cc3bb5de675a2c519068173d by Miss Islington (bot) in branch '3.10':
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH-30958)
https://github.com/python/cpython/commit/e5e1441d41907f92cc3bb5de675a2c519068173d
msg412301 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2022-02-01 19:30
Done, thanks!
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90645
2022-02-01 19:30:35asvetlovsetstatus: open -> closed
resolution: fixed
messages: + msg412301

stage: patch review -> resolved
2022-02-01 19:30:08miss-islingtonsetmessages: + msg412300
2022-02-01 19:29:57miss-islingtonsetmessages: + msg412299
2022-02-01 16:05:27miss-islingtonsetpull_requests: + pull_request29238
2022-02-01 16:05:17miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request29237
2022-02-01 16:05:10asvetlovsetmessages: + msg412285
2022-02-01 09:11:14asvetlovsetversions: - Python 3.7, Python 3.8
2022-01-27 12:20:48mooncell07setkeywords: + patch
stage: patch review
pull_requests: + pull_request29137
2022-01-27 08:22:39asvetlovsetmessages: + msg411843
2022-01-26 19:35:39mooncell07setmessages: + msg411788
2022-01-26 17:04:27asvetlovsetmessages: + msg411778
2022-01-26 17:03:13asvetlovsetmessages: + msg411777
2022-01-26 12:07:20mooncell07setversions: + Python 3.7, Python 3.8, Python 3.9, Python 3.11
2022-01-23 17:21:34mooncell07settitle: `_SSLProtocolTransport` doen't have the `get_write_buffer_limits` implementation. -> `_SSLProtocolTransport` doesn't have the `get_write_buffer_limits` implementation.
2022-01-23 16:49:39mooncell07create