[New-bugs-announce] [issue8467] subprocess: surrogates of the error message (Python implementation on non-Windows)

STINNER Victor report at bugs.python.org
Tue Apr 20 14:02:55 CEST 2010


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

On a non-Windows OS where _posixsubprocess is missing (subprocess uses the pure Python implementation), if the child fails with a Python exception and the exception message contains a surrogate character, message.encode() fails silently (exception while processing exceptions are just ignored).

Surrogates should be passed to the parent process: surrogatepass can be used for that. Attached patch implements this idea with an unit test.

--

_posixsubprocess is not concerned because it writes an empty message for OSError (the parent process calls os.strerror() to get the message) or "Exception occurred in preexec_fn." (pure ASCII string) for RuntimeError.

On Windows, _subprocess.CreateProcess() calls PyErr_SetFromWindowsErr() on failure without the filename. So there is no surrogates here.

----------
components: Library (Lib)
files: subprocess_errmsg.patch
keywords: patch
messages: 103694
nosy: haypo
severity: normal
status: open
title: subprocess: surrogates of the error message (Python implementation on non-Windows)
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17005/subprocess_errmsg.patch

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


More information about the New-bugs-announce mailing list