[New-bugs-announce] [issue16495] bytes_decode() unnecessarily examines encoding

Chris Jerdonek report at bugs.python.org
Sat Nov 17 22:29:49 CET 2012


New submission from Chris Jerdonek:

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

----------
components: Interpreter Core
keywords: easy
messages: 175811
nosy: chris.jerdonek, haypo
priority: normal
severity: normal
status: open
title: bytes_decode() unnecessarily examines encoding
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16495>
_______________________________________


More information about the New-bugs-announce mailing list