bpo-43651: Fix EncodingWarning in `os.fdopen()` and test_os (GH-25654)
diff --git a/Lib/os.py b/Lib/os.py
index ea09e8c..d26cfc9 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -983,16 +983,16 @@ def popen(cmd, mode="r", buffering=-1):
import subprocess, io
if mode == "r":
proc = subprocess.Popen(cmd,
- shell=True,
+ shell=True, text=True,
stdout=subprocess.PIPE,
bufsize=buffering)
- return _wrap_close(io.TextIOWrapper(proc.stdout), proc)
+ return _wrap_close(proc.stdout, proc)
else:
proc = subprocess.Popen(cmd,
- shell=True,
+ shell=True, text=True,
stdin=subprocess.PIPE,
bufsize=buffering)
- return _wrap_close(io.TextIOWrapper(proc.stdin), proc)
+ return _wrap_close(proc.stdin, proc)
# Helper for popen() -- a proxy for a file whose close waits for the process
class _wrap_close: