This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess: surrogates of the error message (Python implementation on non-Windows)
Type: Stage:
Components: Library (Lib), Unicode Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2010-04-20 12:02 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
subprocess_errmsg.patch vstinner, 2010-04-20 12:02
Messages (2)
msg103694 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-20 12:02
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.
msg104045 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-23 20:22
Commited in py3k (r80413), blocked in 3.1 (r80414).

Python 3.1 uses pickle to encode the traceback and pickle supports surrogates (see #8383).
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52713
2010-04-23 20:22:34vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg104045
2010-04-20 12:03:16vstinnerlinkissue8242 dependencies
2010-04-20 12:03:03vstinnersetcomponents: + Unicode
2010-04-20 12:02:54vstinnercreate