summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-04-02 23:48:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-04-02 23:48:39 (GMT)
commitcfc4c13b04223705a43595579b46020c9e876ac4 (patch)
tree238b3c5e9e2ac723e86fa2b3eb711cd5eb45eebf /Include
parent4489e927a6e030f19fee77783ebb209119f4ad60 (diff)
downloadcpython-cfc4c13b04223705a43595579b46020c9e876ac4.zip
cpython-cfc4c13b04223705a43595579b46020c9e876ac4.tar.gz
cpython-cfc4c13b04223705a43595579b46020c9e876ac4.tar.bz2
Add _PyUnicodeWriter_WriteSubstring() function
Write a function to enable more optimizations: * If the substring is the whole string and overallocation is disabled, just keep a reference to the string, don't copy characters * Avoid a call to the expensive _PyUnicode_FindMaxChar() function when possible
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index a70585c..0917307 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -940,6 +940,15 @@ _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer,
PyObject *str /* Unicode string */
);
+/* Append a substring of a Unicode string.
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int)
+_PyUnicodeWriter_WriteSubstring(_PyUnicodeWriter *writer,
+ PyObject *str, /* Unicode string */
+ Py_ssize_t start,
+ Py_ssize_t end
+ );
+
/* Append a latin1-encoded byte string.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)