]> granicus.if.org Git - python/commit
Issue #19619: Blacklist non-text codecs in method API
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 24 Feb 2014 12:43:03 +0000 (14:43 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 24 Feb 2014 12:43:03 +0000 (14:43 +0200)
commit94ee389308ec9e0e07b3f7a944d5179aba540c5e
tree80bc231aff27723119beacbcfa2654b90f793060
parent20f8728bf0cce877c1908b15ddc59e2d1011ad0f
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.

Backported changeset d68df99d7a57.
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