Close #14648: Compute correctly maxchar in str.format() for substrin

This commit is contained in:
Victor Stinner 2012-04-23 23:36:38 +02:00
parent 0b7d7c9544
commit ece58deb9f
4 changed files with 50 additions and 6 deletions

View file

@ -710,6 +710,15 @@ PyAPI_FUNC(PyObject*) PyUnicode_Substring(
Py_ssize_t start,
Py_ssize_t end);
#ifndef Py_LIMITED_API
/* Compute the maximum character of the substring unicode[start:end].
Return 127 for an empty string. */
PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar (
PyObject *unicode,
Py_ssize_t start,
Py_ssize_t end);
#endif
/* Copy the string into a UCS4 buffer including the null character if copy_null
is set. Return NULL and raise an exception on error. Raise a ValueError if
the buffer is smaller than the string. Return buffer on success.