Skip to content

File streams: "BufferedWriter" has incompatible type "BinaryIO"; expected "RawIOBase" #10271

Closed
@h6197627

Description

@h6197627

Bug Report
This code

import io

bf = open('binary.file', 'wb', buffering=0)
print(isinstance(bf, io.RawIOBase)) # > True
bw = io.BufferedWriter(bf)

throws:

test.py:5: error: Argument 1 to "BufferedWriter" has incompatible type "BinaryIO"; expected "RawIOBase"

Your Environment

  • Mypy version used: 0.812
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.6.9
  • Operating system and version: Ubuntu 18.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions