Skip to content

Commit 9a03f9c

Browse files
committed
Revert "pythongh-95027: Fix regrtest stdout encoding on Windows (pythonGH-98492)"
This reverts commit b2aa28e.
1 parent 39bf879 commit 9a03f9c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Lib/test/libregrtest/runtest_mp.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
from test.libregrtest.setup import setup_tests
2222
from test.libregrtest.utils import format_duration, print_warning
2323

24-
if sys.platform == 'win32':
25-
import locale
26-
2724

2825
# Display the running tests if nothing happened last N seconds
2926
PROGRESS_UPDATE = 30.0 # seconds
@@ -262,16 +259,11 @@ def _run_process(self, test_name: str, stdout_fh: TextIO) -> int:
262259
self.current_test_name = None
263260

264261
def _runtest(self, test_name: str) -> MultiprocessResult:
265-
if sys.platform == 'win32':
266-
# gh-95027: When stdout is not a TTY, Python uses the ANSI code
267-
# page for the sys.stdout encoding. If the main process runs in a
268-
# terminal, sys.stdout uses WindowsConsoleIO with UTF-8 encoding.
269-
encoding = locale.getencoding()
270-
else:
271-
encoding = sys.stdout.encoding
272262
# gh-94026: Write stdout+stderr to a tempfile as workaround for
273263
# non-blocking pipes on Emscripten with NodeJS.
274-
with tempfile.TemporaryFile('w+', encoding=encoding) as stdout_fh:
264+
with tempfile.TemporaryFile(
265+
'w+', encoding=sys.stdout.encoding
266+
) as stdout_fh:
275267
# gh-93353: Check for leaked temporary files in the parent process,
276268
# since the deletion of temporary files can happen late during
277269
# Python finalization: too late for libregrtest.

0 commit comments

Comments
 (0)