summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-12-02 18:09:41 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-12-02 18:09:41 (GMT)
commitd132750206afe3d634f46d48c127f8f673aaaae3 (patch)
tree0e7da10c3a88a7af616ece4471897165f48c0666 /Objects
parentc7b78381da592ba32e4cc0925493d85d660cf405 (diff)
downloadcpython-d132750206afe3d634f46d48c127f8f673aaaae3.zip
cpython-d132750206afe3d634f46d48c127f8f673aaaae3.tar.gz
cpython-d132750206afe3d634f46d48c127f8f673aaaae3.tar.bz2
Patch 487906: update inline docs.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 723918d..2e0d6d6 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -19,19 +19,27 @@ static PyStringObject *nullstring;
#endif
/*
- Newsizedstringobject() and newstringobject() try in certain cases
- to share string objects. When the size of the string is zero,
- these routines always return a pointer to the same string object;
- when the size is one, they return a pointer to an already existing
- object if the contents of the string is known. For
- newstringobject() this is always the case, for
- newsizedstringobject() this is the case when the first argument in
- not NULL.
- A common practice to allocate a string and then fill it in or
- change it must be done carefully. It is only allowed to change the
- contents of the string if the obect was gotten from
- newsizedstringobject() with a NULL first argument, because in the
- future these routines may try to do even more sharing of objects.
+ PyString_FromStringAndSize() and PyString_FromString() try in certain cases
+ to share string objects. When the size of the string is zero, these
+ routines always return a pointer to the same string object; when the size
+ is one, they return a pointer to an already existing object if the contents
+ of the string is known. For PyString_FromString() this is always the case,
+ for PyString_FromStringAndSize() this is the case when the first argument
+ in not NULL.
+
+ A common practice of allocating a string and then filling it in or changing
+ it must be done carefully. It is only allowed to change the contents of
+ the string if the object was gotten from PyString_FromStringAndSize() with
+ a NULL first argument, because in the future these routines may try to do
+ even more sharing of objects.
+
+ The parameter `size' denotes number of characters to allocate, not counting
+ the null terminating character. If the `str' argument is not NULL, then it
+ must point to a null-terminated string of length `size'.
+
+ The member `op->ob_size' denotes the number of bytes of data in the string,
+ not counting the null terminating character, and is therefore equal to the
+ `size' parameter.
*/
PyObject *
PyString_FromStringAndSize(const char *str, int size)