Skip to content
Snippets Groups Projects
Commit f9b8ac279227 authored by Pierre Augier's avatar Pierre Augier
Browse files

windows: effect of PYTHONLEGACYWINDOWSSTDIO when not defined

Fix issue6952.
parent 72af9fa34832
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,33 @@
import os
import sys
# PYTHONLEGACYWINDOWSSTDIO=1 even when not defined
if os.name == "nt" and "PYTHONLEGACYWINDOWSSTDIO" not in os.environ:
import io
# avoid deallocation
saved_stdin = sys.__stdin__
saved_stdout = sys.__stdout__
saved_stderr = sys.__stderr__
sys.stdin = io.TextIOWrapper(
io.FileIO(sys.stdin.fileno(), closefd=False), encoding="mbcs"
)
sys.stdout = io.TextIOWrapper(
io.FileIO(sys.stdout.fileno(), "wb", closefd=False),
encoding="mbcs",
errors="replace",
)
sys.stderr = io.TextIOWrapper(
io.FileIO(sys.stderr.fileno(), "wb", closefd=False),
encoding="mbcs",
errors="replace",
)
sys.__stdin__ = sys.stdin
sys.__stdout__ = sys.stdout
sys.__stderr__ = sys.stderr
libdir = '@LIBDIR@'
if libdir != '@' 'LIBDIR' '@':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment