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: PyUnicodeDecodeError_GetObject always return bytes
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: python-dev, serhiy.storchaka, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-10-22 20:53 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
unicodedecodeerror_object_is_bytes.patch serhiy.storchaka, 2016-10-22 20:53 review
Messages (4)
msg279218 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-22 20:53
Since PyUnicodeDecodeError_GetObject() always returns bytes object, following PyBytes_AsString() never fails and can be replaced with the PyBytes_AS_STRING() macro. This makes error handlers looking a littler clearer and a little faster.

The patch is inspired by the patch of Xiang Zhang (issue28504).
msg279236 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-10-23 05:24
LGTM.

Actually I just read the codecs error handles codes last day but didn't think of this. :-(
msg279238 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-23 06:45
New changeset e5e05ac07aee by Serhiy Storchaka in branch 'default':
Issue #28510: Clean up decoding error handlers.
https://hg.python.org/cpython/rev/e5e05ac07aee
msg279239 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-23 06:46
Thank you for your review Xiang.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72696
2016-10-23 06:46:22serhiy.storchakasetstatus: open -> closed
messages: + msg279239

assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2016-10-23 06:45:16python-devsetnosy: + python-dev
messages: + msg279238
2016-10-23 05:24:10xiang.zhangsetmessages: + msg279236
2016-10-22 20:53:48serhiy.storchakacreate