From 495286f3f1fdd4baf576ee02040c4138355df6df Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Mon, 6 Nov 2023 14:51:49 +0300 Subject: [PATCH 1/2] Add missed `stream` argument --- Lib/importlib/resources/simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/importlib/resources/simple.py b/Lib/importlib/resources/simple.py index 7770c922c84fab..96f117fec62c10 100644 --- a/Lib/importlib/resources/simple.py +++ b/Lib/importlib/resources/simple.py @@ -88,7 +88,7 @@ def is_dir(self): def open(self, mode='r', *args, **kwargs): stream = self.parent.reader.open_binary(self.name) if 'b' not in mode: - stream = io.TextIOWrapper(*args, **kwargs) + stream = io.TextIOWrapper(stream, *args, **kwargs) return stream def joinpath(self, name): From 0c9a65575903a8eced221485c5f5d245998d3dce Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Tue, 7 Nov 2023 10:22:31 +0300 Subject: [PATCH 2/2] Add news --- .../next/Library/2023-11-07-10-22-06.gh-issue-111775.IoVxfX.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-11-07-10-22-06.gh-issue-111775.IoVxfX.rst diff --git a/Misc/NEWS.d/next/Library/2023-11-07-10-22-06.gh-issue-111775.IoVxfX.rst b/Misc/NEWS.d/next/Library/2023-11-07-10-22-06.gh-issue-111775.IoVxfX.rst new file mode 100644 index 00000000000000..2a3bdd640ea67d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-11-07-10-22-06.gh-issue-111775.IoVxfX.rst @@ -0,0 +1,2 @@ +Fix :meth:`importlib.resources.simple.ResourceHandle.open` for text mode, +added missed ``stream`` argument.