Clean up references to the no longer existing PyString_ APIs in our docs.

This commit is contained in:
Gregory P. Smith 2013-03-22 13:43:30 -07:00
parent 3f885b5432
commit 4b52ae8f97
4 changed files with 23 additions and 22 deletions

View file

@ -210,7 +210,7 @@ error handling for the moment; a better way to code this is shown below)::
t = PyTuple_New(3);
PyTuple_SetItem(t, 0, PyLong_FromLong(1L));
PyTuple_SetItem(t, 1, PyLong_FromLong(2L));
PyTuple_SetItem(t, 2, PyString_FromString("three"));
PyTuple_SetItem(t, 2, PyUnicode_FromString("three"));
Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately
stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object

View file

@ -61,7 +61,7 @@ example::
if (buf == NULL)
return PyErr_NoMemory();
...Do some I/O operation involving buf...
res = PyString_FromString(buf);
res = PyBytes_FromString(buf);
free(buf); /* malloc'ed */
return res;
@ -169,7 +169,7 @@ I/O buffer is allocated from the Python heap by using the first function set::
if (buf == NULL)
return PyErr_NoMemory();
/* ...Do some I/O operation involving buf... */
res = PyString_FromString(buf);
res = PyBytes_FromString(buf);
PyMem_Free(buf); /* allocated with PyMem_Malloc */
return res;
@ -181,7 +181,7 @@ The same code using the type-oriented function set::
if (buf == NULL)
return PyErr_NoMemory();
/* ...Do some I/O operation involving buf... */
res = PyString_FromString(buf);
res = PyBytes_FromString(buf);
PyMem_Del(buf); /* allocated with PyMem_New */
return res;