diff options
author | Inada Naoki <songofacandy@gmail.com> | 2022-04-19 02:44:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 02:44:36 (GMT) |
commit | 6fdb62b1fa344b9cdf1f221eac83404fb1980822 (patch) | |
tree | 97badf048e8285069490b1753bc1a77f997070e7 /Lib/_pyio.py | |
parent | 39a54ba63850e081a4a5551a773df5b4d5b1d3cd (diff) | |
download | cpython-6fdb62b1fa344b9cdf1f221eac83404fb1980822.zip cpython-6fdb62b1fa344b9cdf1f221eac83404fb1980822.tar.gz cpython-6fdb62b1fa344b9cdf1f221eac83404fb1980822.tar.bz2 |
gh-91526: io: Remove device encoding support from TextIOWrapper (GH-91529)
`TextIOWrapper.__init__()` called `os.device_encoding(file.fileno())` if fileno is 0-2 and encoding=None.
But it is very rarely works, and never documented behavior.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 0f33ed5..380a7a7 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -2021,14 +2021,6 @@ class TextIOWrapper(TextIOBase): self._check_newline(newline) encoding = text_encoding(encoding) - if encoding == "locale" and sys.platform == "win32": - # On Unix, os.device_encoding() returns "utf-8" instead of locale encoding - # in the UTF-8 mode. So we use os.device_encoding() only on Windows. - try: - encoding = os.device_encoding(buffer.fileno()) or "locale" - except (AttributeError, UnsupportedOperation): - pass - if encoding == "locale": try: import locale |