diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-03-22 20:49:26 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-03-22 20:49:26 (GMT) |
commit | bcd2aa6d06934fad049aaf107d98e741a7e4440c (patch) | |
tree | 67b9927e6a159c1f92f68e78cbbe538339b46461 /Doc/c-api | |
parent | 340a4bb2fe38f7d203beb7890d75e0383e3cca7c (diff) | |
parent | 4b52ae8f971152c2189de1031a7219d33846670d (diff) | |
download | cpython-bcd2aa6d06934fad049aaf107d98e741a7e4440c.zip cpython-bcd2aa6d06934fad049aaf107d98e741a7e4440c.tar.gz cpython-bcd2aa6d06934fad049aaf107d98e741a7e4440c.tar.bz2 |
cleanup references to PyString_ APIs from 2.x in the 3.3 docs.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/intro.rst | 2 | ||||
-rw-r--r-- | Doc/c-api/memory.rst | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index 6464fe7..bc3a752 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -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 diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index 5465571..8afa56a 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -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; |