diff options
| author | Inada Naoki <songofacandy@gmail.com> | 2021-04-27 15:45:31 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-27 15:45:31 +0900 |
| commit | caae717c2903fff4704b59714bc0c65d60108321 (patch) | |
| tree | ce71a18fa1bcb94a88dbd06b746cd3bb685df83c /Lib/zipfile.py | |
| parent | 5987b8c463892e0ab7a63cdae92f34b5eb79732d (diff) | |
| download | cpython-git-caae717c2903fff4704b59714bc0c65d60108321.tar.gz | |
bpo-43651: Fix EncodingWarning in zipfile (GH-25650)
Diffstat (limited to 'Lib/zipfile.py')
| -rw-r--r-- | Lib/zipfile.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 0eed4ce9a6..d99c0d7697 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -2334,6 +2334,8 @@ class Path: if args or kwargs: raise ValueError("encoding args invalid for binary operation") return stream + else: + kwargs["encoding"] = io.text_encoding(kwargs.get("encoding")) return io.TextIOWrapper(stream, *args, **kwargs) @property @@ -2345,6 +2347,7 @@ class Path: return pathlib.Path(self.root.filename).joinpath(self.at) def read_text(self, *args, **kwargs): + kwargs["encoding"] = io.text_encoding(kwargs.get("encoding")) with self.open('r', *args, **kwargs) as strm: return strm.read() |
