mirror of
https://github.com/python/cpython.git
synced 2025-09-28 03:13:48 +00:00
_pyio: Fix TextIOWrapper constructor: os has no device_encoding() function
_io module doesn't call this function which was introduced in Python3.
This commit is contained in:
parent
268e4872d3
commit
7120219918
1 changed files with 6 additions and 11 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue