mirror of
https://github.com/python/cpython.git
synced 2025-07-15 15:25:29 +00:00
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:
parent
078151da90
commit
cc8764ca9d
5 changed files with 82 additions and 35 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue