Commit 71202199 authored by Victor Stinner's avatar Victor Stinner

_pyio: Fix TextIOWrapper constructor: os has no device_encoding() function

_io module doesn't call this function which was introduced in Python3.
parent 268e4872
...@@ -1436,11 +1436,6 @@ class TextIOWrapper(TextIOBase): ...@@ -1436,11 +1436,6 @@ class TextIOWrapper(TextIOBase):
raise TypeError("illegal newline type: %r" % (type(newline),)) raise TypeError("illegal newline type: %r" % (type(newline),))
if newline not in (None, "", "\n", "\r", "\r\n"): if newline not in (None, "", "\n", "\r", "\r\n"):
raise ValueError("illegal newline value: %r" % (newline,)) raise ValueError("illegal newline value: %r" % (newline,))
if encoding is None:
try:
encoding = os.device_encoding(buffer.fileno())
except (AttributeError, UnsupportedOperation):
pass
if encoding is None: if encoding is None:
try: try:
import locale import locale
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment