Part of SF patch #1313939: Speedup charmap decoding by extending

PyUnicode_DecodeCharmap() the accept a unicode string as the mapping
argument which is used as a mapping table.

This code isn't used by any of the codecs yet.
This commit is contained in:
Walter Dörwald 2005-10-06 20:29:57 +00:00
parent 331649acc7
commit d1c1e10f70
4 changed files with 157 additions and 80 deletions

View file

@ -1322,7 +1322,12 @@ points.
const char *errors}
Create a Unicode object by decoding \var{size} bytes of the encoded
string \var{s} using the given \var{mapping} object. Return
\NULL{} if an exception was raised by the codec.
\NULL{} if an exception was raised by the codec. If \var{mapping} is \NULL{}
latin-1 decoding will be done. Else it can be a dictionary mapping byte or a
unicode string, which is treated as a lookup table. Byte values greater
that the length of the string and U+FFFE "characters" are treated as
"undefined mapping".
\versionchanged[Allowed unicode string as mapping argument]{2.4}
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyUnicode_EncodeCharmap}{const Py_UNICODE *s,