summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index b23f8a7..3538f1a 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -519,10 +519,22 @@ PyAPI_FUNC(int) _PyUnicode_Ready(
#endif
/* Copy character from one unicode object into another, this function performs
- character conversion when nessesary and falls back to memcpy if possible.
- Return -1 and raise an exception on error, return 0 on success. */
+ character conversion when necessary and falls back to memcpy if possible.
+
+ Fail if 'to' is smaller than how_many or smaller than len(from)-from_start,
+ or if kind(from[from_start:from_start+how_many]) > kind(to).
+
+ Return the number of written character, or return -1 and raise an exception
+ on error.
+
+ Pseudo-code:
+
+ how_many = min(how_many, len(from) - from_start)
+ to[to_start:to_start+how_many] = from[from_start:from_start+how_many]
+ return how_many
+ */
#ifndef Py_LIMITED_API
-PyAPI_FUNC(int) PyUnicode_CopyCharacters(
+PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
PyObject *to,
Py_ssize_t to_start,
PyObject *from,