Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BufferedRWPair annotations #13495

Copy link
Copy link
Open
@CodeMouse92

Description

@CodeMouse92
Issue body actions

Bug Report

It is typical to initialize an io.BufferedRWPair with the returns of Path.open() (in binary mode) as the arguments, and this works as expected.

BufferedRWPair(
        Path('readfrom.dat').open('rb'),
        Path('writeto.dat').open('wb')
)

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.13&gist=79ee15dce5f93b8aa66a2a04c7bedcdc

Expected Behavior

Type checking should pass.

Actual Behavior

The type checking fails with:

error: Argument 1 to "BufferedRWPair" has incompatible type "BufferedReader"; expected "RawIOBase"  [arg-type]
error: Argument 2 to "BufferedRWPair" has incompatible type "BufferedWriter"; expected "RawIOBase"  [arg-type]

Your Environment

  • Mypy version used: 1.15.0
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
strict = true
  • Python version used: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.