Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3de78fbc
Commit
3de78fbc
authored
Dec 02, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch 487906: update inline docs.
parent
0009419c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
Objects/stringobject.c
Objects/stringobject.c
+21
-13
No files found.
Objects/stringobject.c
View file @
3de78fbc
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment