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.

Author vstinner
Recipients doerwalter, ezio.melotti, lemburg, ncoghlan, serhiy.storchaka, vstinner
Date 2013-11-19.14:27:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1384871243.26.0.0846102721639.issue19619@psf.upfronthosting.co.za>
In-reply-to
Content
+    /* A set would be faster, but when to build it, where to store it? */
+    if (_PyUnicode_CompareWithId(codec_name, &PyId_base64) == 0 ||
+        _PyUnicode_CompareWithId(codec_name, &PyId_uu) == 0 ||
+        _PyUnicode_CompareWithId(codec_name, &PyId_quopri) == 0 ||
+        _PyUnicode_CompareWithId(codec_name, &PyId_hex) == 0 ||
+        _PyUnicode_CompareWithId(codec_name, &PyId_bz2) == 0 ||
+        _PyUnicode_CompareWithId(codec_name, &PyId_zlib) == 0 ||
+        PyUnicode_CompareWithASCIIString(codec_name, "rot-13") == 0
+       ) {
+        is_text_codec = 0;
+    }

This is slow and not future proof. It would be faster and simpler to have two registries: a register only for bytes.decode()/str.encode() and another for "custom codecs" for codecs.encode/decode (or (bytes|str).transform()/untransform()).

So "abc".encode("rot13") would simply fail with a LookupError.
History
Date User Action Args
2013-11-19 14:27:23vstinnersetrecipients: + vstinner, lemburg, doerwalter, ncoghlan, ezio.melotti, serhiy.storchaka
2013-11-19 14:27:23vstinnersetmessageid: <1384871243.26.0.0846102721639.issue19619@psf.upfronthosting.co.za>
2013-11-19 14:27:23vstinnerlinkissue19619 messages
2013-11-19 14:27:23vstinnercreate