Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.

u'%c' will now raise a ValueError in case the argument is an
integer outside the valid range of Unicode code point ordinals.

Closes SF bug #593581.
This commit is contained in:
Marc-André Lemburg 2002-08-11 12:23:04 +00:00
parent 078151da90
commit cc8764ca9d
5 changed files with 82 additions and 35 deletions

View file

@ -517,6 +517,18 @@ extern DL_IMPORT(int) PyUnicode_AsWideChar(
#endif
/* --- Unicode ordinals --------------------------------------------------- */
/* Create a Unicode Object from the given Unicode code point ordinal.
The ordinal must be in range(0x10000) on narrow Python builds
(UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is
raised in case it is not.
*/
extern DL_IMPORT(PyObject*) PyUnicode_FromOrdinal(int ordinal);
/* === Builtin Codecs =====================================================
Many of these APIs take two arguments encoding and errors. These