summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 05e9c32..ea09e8c 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -1020,11 +1020,13 @@ if sys.platform != 'vxworks':
__all__.append("popen")
# Supply os.fdopen()
-def fdopen(fd, *args, **kwargs):
+def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs):
if not isinstance(fd, int):
raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
import io
- return io.open(fd, *args, **kwargs)
+ if "b" not in mode:
+ encoding = io.text_encoding(encoding)
+ return io.open(fd, mode, buffering, encoding, *args, **kwargs)
# For testing purposes, make sure the function is available when the C