10000 Fix os.fdopen() · python/cpython@4ecbd81 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ecbd81

Browse files
committed
Fix os.fdopen()
1 parent d12c069 commit 4ecbd81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/os.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,8 @@ def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs):
10241024
if not isinstance(fd, int):
10251025
raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
10261026
import io
1027-
encoding = io.text_encoding(encoding)
1027+
if "b" not in mode:
1028+
encoding = io.text_encoding(encoding)
10281029
return io.open(fd, mode, buffering, encoding, *args, **kwargs)
10291030

10301031

0 commit comments

Comments
 (0)
0