Add a new PyUnicode_Fill() function

It is faster than the unicode_fill() function which was implemented in
formatter_unicode.c.
This commit is contained in:
Victor Stinner 2012-01-04 00:33:50 +01:00
parent 332503db07
commit 3fe553160c
4 changed files with 76 additions and 18 deletions

View file

@ -564,6 +564,21 @@ APIs:
.. versionadded:: 3.3
.. c:function:: int PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \
Py_ssize_t length, Py_UCS4 fill_char)
Fill a string with a character: write *fill_char* into
``unicode[start:start+length]``.
Fail if *fill_char* is bigger than the string maximum character, or if the
string has more than 1 reference.
Return the number of written character, or return ``-1`` and raise an
exception on error.
.. versionadded:: 3.3
.. c:function:: int PyUnicode_WriteChar(PyObject *unicode, Py_ssize_t index, \
Py_UCS4 character)