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.

Title: bytes_decode() unnecessarily examines encoding
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, chris.jerdonek, ezio.melotti, jcea, python-dev, vstinner
Priority: normal Keywords: easy, patch

Created on 2012-11-17 21:29 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue-16495-1-default.patch chris.jerdonek, 2012-11-19 07:54 review
Messages (5)
msg175811 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-11-17 21:29
The code below in bytes_decode() is unnecessary:

    if (encoding == NULL)
        encoding = PyUnicode_GetDefaultEncoding();

(from )

because PyUnicode_FromEncodedObject() already handles the case of NULL encoding (inside normalize_encoding() called by PyUnicode_Decode()):
msg175813 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-11-17 21:50
For the record, there is a test for the default encoding:
msg175947 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-11-19 07:54
Patch attached.  The tests pass.
msg177100 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-07 17:15
msg177138 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-12-07 23:54
New changeset 3fb9e38b00e8 by Chris Jerdonek in branch 'default':
Issue #16495: remove extraneous NULL encoding check from bytes_decode().
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60699
2012-12-07 23:55:53chris.jerdoneksetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2012-12-07 23:54:13python-devsetnosy: + python-dev
messages: + msg177138
2012-12-07 17:15:55asvetlovsetmessages: + msg177100
2012-12-03 15:38:19asvetlovsetnosy: + asvetlov
2012-11-29 04:22:54ezio.melottisetnosy: + ezio.melotti
2012-11-26 17:14:53jceasetnosy: + jcea
2012-11-19 07:54:33chris.jerdoneksetfiles: + issue-16495-1-default.patch
keywords: + patch
messages: + msg175947
2012-11-17 21:50:51chris.jerdoneksetmessages: + msg175813
2012-11-17 21:41:11serhiy.storchakasetstage: needs patch
2012-11-17 21:29:49chris.jerdonekcreate