Title: Cleanup unicode_decode_call_errorhandler_wchar/writer
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: python-dev, serhiy.storchaka, vstinner, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-10-22 15:25 by xiang.zhang, last changed 2016-10-22 20:56 by serhiy.storchaka. This issue is now closed.

File name Uploaded Description Edit
unicode_decode_call_errorhandler_*.patch xiang.zhang, 2016-10-22 15:25 review
Messages (3)
msg279198 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-10-22 15:25
The patch makes several cleanups to unicode_decode_call_errorhandler_wchar/writer:

1. Use U instead O! for argument parser, it ought to be more efficient and write less code.
2. In theory, if inputobj is not bytes, there needs to be a goto onError, or it could crash. But PyUnicodeDecodeError_GetObject is guaranteed to return bytes, so we can remove the incomplete branch.
3. On success, we don't need Xdecref.
msg279217 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-22 20:18
New changeset 204a43c452cc by Serhiy Storchaka in branch 'default':
Issue #28504: Cleanup unicode_decode_call_errorhandler_wchar/writer.
msg279220 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-22 20:56
LGTM. Thank you Xiang.

I have extended your approach to all sources and have written other two patches: issues28510 and issue28511.
Date User Action Args
2016-10-22 20:56:46serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg279220

stage: patch review -> resolved
2016-10-22 20:18:53python-devsetnosy: + python-dev
messages: + msg279217
2016-10-22 16:04:43serhiy.storchakasetassignee: serhiy.storchaka
2016-10-22 15:25:14xiang.zhangcreate