Message203380
+ /* 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. |
|
Date |
User |
Action |
Args |
2013-11-19 14:27:23 | vstinner | set | recipients:
+ vstinner, lemburg, doerwalter, ncoghlan, ezio.melotti, serhiy.storchaka |
2013-11-19 14:27:23 | vstinner | set | messageid: <1384871243.26.0.0846102721639.issue19619@psf.upfronthosting.co.za> |
2013-11-19 14:27:23 | vstinner | link | issue19619 messages |
2013-11-19 14:27:23 | vstinner | create | |
|