From d44f1c65239c3e33509224aa1931631243dbfa7f Mon Sep 17 00:00:00 2001 From: Tero Vuotila Date: Wed, 16 Jul 2025 12:21:50 +0300 Subject: [PATCH] relax type hint for bytes io --- CHANGES.rst | 1 + src/flask/helpers.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1c41e34b..a5761bc2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ Unreleased - When using ``follow_redirects`` in the test client, the final state of ``session`` is correct. :issue:`5786` +- Relax type hint for passing bytes IO to ``send_file``. :issue:`5776` Version 3.1.1 diff --git a/src/flask/helpers.py b/src/flask/helpers.py index 90a0e0c6..081548a9 100644 --- a/src/flask/helpers.py +++ b/src/flask/helpers.py @@ -398,7 +398,7 @@ def _prepare_send_file_kwargs(**kwargs: t.Any) -> dict[str, t.Any]: def send_file( - path_or_file: os.PathLike[t.AnyStr] | str | t.BinaryIO, + path_or_file: os.PathLike[t.AnyStr] | str | t.IO[bytes], mimetype: str | None = None, as_attachment: bool = False, download_name: str | None = None,