Issue 1546052: PyString_FromString() clarification - Python tracker (original) (raw)
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."