Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_SSLProtocolTransport doesn't have the get_write_buffer_limits implementation. #90645

Closed
mooncell07 mannequin opened this issue Jan 23, 2022 · 9 comments
Closed

_SSLProtocolTransport doesn't have the get_write_buffer_limits implementation. #90645

mooncell07 mannequin opened this issue Jan 23, 2022 · 9 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-asyncio type-feature A feature request or enhancement

Comments

@mooncell07
Copy link
Mannequin

mooncell07 mannequin commented Jan 23, 2022

BPO 46487
Nosy @asvetlov, @1st1, @miss-islington, @mooncell07
PRs
  • bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports #30958
  • [3.10] bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958) #31055
  • [3.9] bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958) #31056
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-02-01.19:30:35.731>
    created_at = <Date 2022-01-23.16:49:39.862>
    labels = ['3.11', 'type-feature', '3.9', '3.10', 'expert-asyncio']
    title = "`_SSLProtocolTransport` doesn't have the `get_write_buffer_limits` implementation."
    updated_at = <Date 2022-02-01.19:30:35.729>
    user = 'https://github.com/mooncell07'

    bugs.python.org fields:

    activity = <Date 2022-02-01.19:30:35.729>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-01.19:30:35.731>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2022-01-23.16:49:39.862>
    creator = 'mooncell07'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46487
    keywords = ['patch']
    message_count = 9.0
    messages = ['411382', '411777', '411778', '411788', '411843', '412285', '412299', '412300', '412301']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'yselivanov', 'miss-islington', 'mooncell07']
    pr_nums = ['30958', '31055', '31056']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue46487'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @mooncell07
    Copy link
    Mannequin Author

    mooncell07 mannequin commented Jan 23, 2022

    When calling get_write_buffer_limits on a SSL transport the following exception is raised:

    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.

    @mooncell07 mooncell07 mannequin added 3.10 only security fixes topic-asyncio type-feature A feature request or enhancement labels Jan 23, 2022
    @mooncell07 mooncell07 mannequin changed the title _SSLProtocolTransport doen't have the get_write_buffer_limits implementation. _SSLProtocolTransport doesn't have the get_write_buffer_limits implementation. Jan 23, 2022
    @mooncell07 mooncell07 mannequin changed the title _SSLProtocolTransport doen't have the get_write_buffer_limits implementation. _SSLProtocolTransport doesn't have the get_write_buffer_limits implementation. Jan 23, 2022
    @mooncell07 mooncell07 mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.11 only security fixes labels Jan 26, 2022
    @asvetlov
    Copy link
    Contributor

    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.

    @asvetlov
    Copy link
    Contributor

    Forgot to write, after making the method public we can implement it in SSL transport easily.

    @mooncell07
    Copy link
    Mannequin Author

    mooncell07 mannequin commented Jan 26, 2022

    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.

    @asvetlov
    Copy link
    Contributor

    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.

    @asvetlov asvetlov removed 3.7 (EOL) end of life 3.8 only security fixes labels Feb 1, 2022
    @asvetlov
    Copy link
    Contributor

    asvetlov commented Feb 1, 2022

    New changeset 64568ac by Emiya in branch 'main':
    bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958)
    64568ac

    @miss-islington
    Copy link
    Contributor

    New changeset e4a6e54 by Miss Islington (bot) in branch '3.9':
    bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958)
    e4a6e54

    @miss-islington
    Copy link
    Contributor

    New changeset e5e1441 by Miss Islington (bot) in branch '3.10':
    bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958)
    e5e1441

    @asvetlov
    Copy link
    Contributor

    asvetlov commented Feb 1, 2022

    Done, thanks!

    @asvetlov asvetlov closed this as completed Feb 1, 2022
    @asvetlov asvetlov closed this as completed Feb 1, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes topic-asyncio type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants