diff options
author | Victor Stinner <vstinner@wyplay.com> | 2011-10-05 12:01:42 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@wyplay.com> | 2011-10-05 12:01:42 (GMT) |
commit | b9275c104e50361fe3a785126e5ecad24d319a7a (patch) | |
tree | d901fac5c205332619a42c186063dd269261aedd /Include | |
parent | 702c7343957ec4369e89e738fdd157a435f2461f (diff) | |
download | cpython-b9275c104e50361fe3a785126e5ecad24d319a7a.zip cpython-b9275c104e50361fe3a785126e5ecad24d319a7a.tar.gz cpython-b9275c104e50361fe3a785126e5ecad24d319a7a.tar.bz2 |
Speedup str[a:b] and PyUnicode_FromKindAndData
* str[a:b] doesn't scan the string for the maximum character if the string
is ascii only
* PyUnicode_FromKindAndData() stops if we are sure that we cannot use a
shorter character type. For example, _PyUnicode_FromUCS1() stops if we
have at least one character in range U+0080-U+00FF
Diffstat (limited to 'Include')
-rw-r--r-- | Include/unicodeobject.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index a18b3dd..0c2b488 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -654,6 +654,8 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromString( const char *u /* UTF-8 encoded string */ ); +/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters. + Scan the string to find the maximum character. */ #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData( int kind, |