From b300b3d22d889ed72090a4bc9638ed8ff436dd95 Mon Sep 17 00:00:00 2001 From: lipengyu Date: Fri, 11 Sep 2026 15:55:37 +0800 Subject: [PATCH] gh-137070: Clarify Traversable.open text parameters --- Doc/library/importlib.resources.abc.rst | 4 ++-- Lib/importlib/resources/abc.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/importlib.resources.abc.rst b/Doc/library/importlib.resources.abc.rst index 45979c5691270aa..0c9f795a738c6f7 100644 --- a/Doc/library/importlib.resources.abc.rst +++ b/Doc/library/importlib.resources.abc.rst @@ -157,8 +157,8 @@ *mode* may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as :attr:`pathlib.Path.open`). - When opening as text, accepts encoding parameters such as those - accepted by :class:`io.TextIOWrapper`. + When opening as text, accepts the *encoding*, *errors*, and *newline* + keyword arguments with the same meanings as in :class:`io.TextIOWrapper`. .. method:: read_bytes() diff --git a/Lib/importlib/resources/abc.py b/Lib/importlib/resources/abc.py index 0b5fdee80e87964..7cd5401314cedb9 100644 --- a/Lib/importlib/resources/abc.py +++ b/Lib/importlib/resources/abc.py @@ -154,8 +154,8 @@ def open(self, mode: str = 'r', *args: Any, **kwargs: Any) -> TextIO | BinaryIO: mode may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as pathlib.Path.open). - When opening as text, accepts encoding parameters such as those - accepted by io.TextIOWrapper. + When opening as text, accepts the encoding, errors, and newline + keyword arguments with the same meanings as in io.TextIOWrapper. """ @property