summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-09-29 12:14:38 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-09-29 12:14:38 (GMT)
commita0702ab1fe6bda8e1cbe1d5fedc3e0ba07e299dd (patch)
tree8281535ac9844dbbb50bffc0ea3756cd80aee552 /Include
parentff1ef074ede8574ad3a346810e08a45ab171416d (diff)
downloadcpython-a0702ab1fe6bda8e1cbe1d5fedc3e0ba07e299dd.zip
cpython-a0702ab1fe6bda8e1cbe1d5fedc3e0ba07e299dd.tar.gz
cpython-a0702ab1fe6bda8e1cbe1d5fedc3e0ba07e299dd.tar.bz2
Add a note in PyUnicode_CopyCharacters() doc: it doesn't write null character
Cleanup also the code (avoid the goto).
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 99f54c3..a8c3e8b 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -521,9 +521,9 @@ PyAPI_FUNC(int) _PyUnicode_Ready(
/* Copy character from one unicode object into another, this function performs
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), or if to has
- more than 1 reference.
+ Fail if to is too small (smaller than how_many or smaller than
+ len(from)-from_start), or if kind(from[from_start:from_start+how_many]) >
+ kind(to), or if to has more than 1 reference.
Return the number of written character, or return -1 and raise an exception
on error.
@@ -533,6 +533,8 @@ PyAPI_FUNC(int) _PyUnicode_Ready(
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
+
+ Note: The function doesn't write a terminating null character.
*/
#ifndef Py_LIMITED_API
PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(