]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Issue #19619: Blacklist non-text codecs in method API
authorNick Coghlan <ncoghlan@gmail.com>
Fri, 22 Nov 2013 12:39:36 +0000 (22:39 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Fri, 22 Nov 2013 12:39:36 +0000 (22:39 +1000)
commitc72e4e6dccce99bcdcb45959767436d7e5cfda8c
tree029832d80cc82a039dc1014302c9eb9dd2214543
parent322f5ba0d8d5e8a9cd2a134fa215884b4cbc373d
Issue #19619: Blacklist non-text codecs in method API

str.encode, bytes.decode and bytearray.decode now use an
internal API to throw LookupError for known non-text encodings,
rather than attempting the encoding or decoding operation and
then throwing a TypeError for an unexpected output type.

The latter mechanism remains in place for third party non-text
encodings.
13 files changed:
Include/codecs.h
Lib/codecs.py
Lib/encodings/base64_codec.py
Lib/encodings/bz2_codec.py
Lib/encodings/hex_codec.py
Lib/encodings/quopri_codec.py
Lib/encodings/rot_13.py
Lib/encodings/uu_codec.py
Lib/encodings/zlib_codec.py
Lib/test/test_codecs.py
Misc/NEWS
Objects/unicodeobject.c
Python/codecs.c