Skip to content

Conversation

patchback[bot]
Copy link
Contributor

@patchback patchback bot commented Jul 3, 2025

This is a backport of PR #11234 as merged into master (a83597f).

What do these changes do?

This PR updates the web reference docs of aiohttp.web.WebSocketResponse.send_frame et al. with previously missing :raise declarations.

Most notably, send_frame, send_str, send_bytes, and send_json all raise aiohttp.ClientConnectionResetError, which was previously undocumented. Additionally, it was not documented that send_frame may raise a RuntimeError if the connection is not started yet.

For reference, here are the relevant code snippets:
  • send_frame raising RuntimeError if the connection is not started yet:

    aiohttp/aiohttp/web_ws.py

    Lines 405 to 411 in 7c3afd2

    async def send_frame(
    self, message: bytes, opcode: WSMsgType, compress: Optional[int] = None
    ) -> None:
    """Send a frame over the websocket."""
    if self._writer is None:
    raise RuntimeError("Call .prepare() first")
    await self._writer.send_frame(message, opcode, compress)
  • send_frame et al. raising aiohttp.ClientConnectionResetError if the connection is closing:
    if self._closing and not (opcode & WSMsgType.CLOSE):
    raise ClientConnectionResetError("Cannot write to closing transport")

    if self.transport.is_closing():
    raise ClientConnectionResetError("Cannot write to closing transport")

Are there changes in behavior for the user?

No

Is it a substantial burden for the maintainers to support this?

pause

No

Related issue number

n/a

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

Copy link

codspeed-hq bot commented Jul 3, 2025

CodSpeed Performance Report

Merging #11263 will not alter performance

Comparing patchback/backports/3.13/a83597fa88be7ac7dd5f6081d236d751cb40fe4d/pr-11234 (db64df3) with 3.13 (9d61fc4)

Summary

✅ 59 untouched benchmarks

@Dreamsorcerer Dreamsorcerer merged commit c9b8548 into 3.13 Jul 3, 2025
35 checks passed
@Dreamsorcerer Dreamsorcerer deleted the patchback/backports/3.13/a83597fa88be7ac7dd5f6081d236d751cb40fe4d/pr-11234 branch July 3, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants