classification
Title: PyString_FromString() clarification
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cwalther, georg.brandl (2)
Priority: normal Keywords

Created on 2006-08-24 15:38 by cwalther, last changed 2006-09-30 12:04 by georg.brandl.

Messages (2)
msg29676 - (view) Author: Christian Walther (cwalther) Date: 2006-08-24 15:38
The documentation for PyObject* PyString_FromString(
const char *v) in the "Python/C API Reference Manual,
29 March 2006, Release 2.4.3", section 7.3.1 "String
Objects"
<http://docs.python.org/api/stringObjects.html>, does
not mention whether this function makes a copy of the
passed C string or just keeps the pointer.

Google provides some posts on various mailing lists and
forums that seem to indicate that it indeed does copy
the string (which is the right thing to do, of course).

Could something like to following be added to the
documentation?

"This function makes a copy of the string pointed to by
v, so you may modify or deallocate it afterwards
without affecting the Python object created by this
function."
msg29677 - (view) Author: Georg Brandl (georg.brandl) Date: 2006-09-30 12:04
Logged In: YES 
user_id=849994

Thanks for the suggestion! Added clarification in rev.
52078, 52079 (2.5).
History
Date User Action Args
2006-08-24 15:38:32cwalthercreate