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
标题: subprocess: surrogates of the error message (Python implementation on non-Windows)
类型: Stage:
Components: Library (Lib), Unicode Versions: Python 3.1, Python 3.2
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: vstinner
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
subprocess_errmsg.patch vstinner, 2010-04-20 12:02
Messages (2)
msg103694 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 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) 日期: 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).
历史
日期 用户 动作 参数
2022-04-11 14:57:00admin修改github: 52713
2010-04-23 20:22:34vstinner修改状态: open -> closed
resolution: fixed
消息: + msg104045
2010-04-20 12:03:16vstinner链接issue8242 dependencies
2010-04-20 12:03:03vstinner修改components: + Unicode
2010-04-20 12:02:54vstinner创建