Skip to content

Commit 1dfd7cd

Browse files
authored
use IO[bytes] instead of BinaryIO for wider compatibility (#5777)
2 parents c56c5ec + d44f1c6 commit 1dfd7cd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Unreleased
55

66
- When using ``follow_redirects`` in the test client, the final state
77
of ``session`` is correct. :issue:`5786`
8+
- Relax type hint for passing bytes IO to ``send_file``. :issue:`5776`
89

910

1011
Version 3.1.1

src/flask/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def _prepare_send_file_kwargs(**kwargs: t.Any) -> dict[str, t.Any]:
398398

399399

400400
def send_file(
401-
path_or_file: os.PathLike[t.AnyStr] | str | t.BinaryIO,
401+
path_or_file: os.PathLike[t.AnyStr] | str | t.IO[bytes],
402402
mimetype: str | None = None,
403403
as_attachment: bool = False,
404404
download_name: str | None = None,

0 commit comments

Comments
 (0)