Issue 16495: bytes_decode() unnecessarily examines encoding
Created on 2012-11-17 21:29 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| 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) * ![]() |
Date: 2012-11-17 21:29 | |
The code below in bytes_decode() is unnecessary:
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
(from http://hg.python.org/cpython/file/e9af9b1ca67e/Objects/bytesobject.c#l2230 )
because PyUnicode_FromEncodedObject() already handles the case of NULL encoding (inside normalize_encoding() called by PyUnicode_Decode()):
http://hg.python.org/cpython/file/e9af9b1ca67e/Objects/unicodeobject.c#l2811
|
|||
| msg175813 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-11-17 21:50 | |
For the record, there is a test for the default encoding: http://hg.python.org/cpython/file/e9af9b1ca67e/Lib/test/test_bytes.py#l209 |
|||
| msg175947 - (view) | Author: Chris Jerdonek (chris.jerdonek) * ![]() |
Date: 2012-11-19 07:54 | |
Patch attached. The tests pass. |
|||
| msg177100 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2012-12-07 17:15 | |
LGTM |
|||
| msg177138 - (view) | Author: Roundup Robot (python-dev) ![]() |
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(). http://hg.python.org/cpython/rev/3fb9e38b00e8 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:38 | admin | set | github: 60699 |
| 2012-12-07 23:55:53 | chris.jerdonek | set | status: open -> closed resolution: fixed stage: needs patch -> resolved |
| 2012-12-07 23:54:13 | python-dev | set | nosy:
+ python-dev messages: + msg177138 |
| 2012-12-07 17:15:55 | asvetlov | set | messages: + msg177100 |
| 2012-12-03 15:38:19 | asvetlov | set | nosy:
+ asvetlov |
| 2012-11-29 04:22:54 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2012-11-26 17:14:53 | jcea | set | nosy:
+ jcea |
| 2012-11-19 07:54:33 | chris.jerdonek | set | files:
+ issue-16495-1-default.patch keywords: + patch messages: + msg175947 |
| 2012-11-17 21:50:51 | chris.jerdonek | set | messages: + msg175813 |
| 2012-11-17 21:41:11 | serhiy.storchaka | set | stage: needs patch |
| 2012-11-17 21:29:49 | chris.jerdonek | create | |

