[New-bugs-announce] [issue8533] regrtest: use backslashreplace error handler for stdout

STINNER Victor report at bugs.python.org
Mon Apr 26 12:43:13 CEST 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

If a test fails, regrtest writes the backtrace to sys.stdout. If the backtrace contains a non-ASCII characters, it's encoded using sys.stdout encoding.

In some conditions, sys.stdout is unable to encode some or all non-ASCII characters. Eg. if there is no locale set (empty environment or at least empty LANG variable value), sys.stdout.encoding="ascii".

If regrtest fails to display a test output (error backtrace), regrtest exits directly (don't execute next tests).

I propose to use backslashreplace error handler in sys.stdout, as done for sys.stderr to avoid this annoying issue.

Attached patch (for py3k) replace sys.stdout by a new file using backslashreplace, just before executing the tests.

I don't know if the issue concerns also Python2.

----------
files: regrtest_stdout_backslashreplace.patch
keywords: patch
messages: 104212
nosy: haypo
severity: normal
status: open
title: regrtest: use backslashreplace error handler for stdout
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17090/regrtest_stdout_backslashreplace.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8533>
_______________________________________


More information about the New-bugs-announce mailing list