Skip to content

Bring BufferedRWPair to parity with other BufferedIO code #162246

Open

Description

@cmaloney

Bug report

Meta bug to fix a number of issues in BufferedRWPair. Backports should be decided on a case by case basis.

  • re-init leaks the old reader and writer
  • Several methods are not forwarded but should be (ex. fileno, name, mode); breaks duck typing with other socket.makefile() construction options.
  • Should warn on deallocation if not properly closed like other BufferedWriter do
  • The _forward_call adds significant overhead which can be avoided.
  • Data loss if deallocated with unwritten data (explicit close does not lose data).
  • io.BufferedRWPair doc warning may need clarification #82776: socket uses exactly the "Same object to read and write" pattern, so the docs should be fixed

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. self-assigned this
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions