summaryrefslogtreecommitdiffstats
path: root/Doc/faq/extending.rst
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2013-03-22 20:49:26 (GMT)
committerGregory P. Smith <greg@krypto.org>2013-03-22 20:49:26 (GMT)
commitbcd2aa6d06934fad049aaf107d98e741a7e4440c (patch)
tree67b9927e6a159c1f92f68e78cbbe538339b46461 /Doc/faq/extending.rst
parent340a4bb2fe38f7d203beb7890d75e0383e3cca7c (diff)
parent4b52ae8f971152c2189de1031a7219d33846670d (diff)
downloadcpython-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/faq/extending.rst')
-rw-r--r--Doc/faq/extending.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index fa245c7..4afb510 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -82,18 +82,20 @@ returns its length and :c:func:`PyTuple_GetItem` returns the item at a specified
index. Lists have similar functions, :c:func:`PyListSize` and
:c:func:`PyList_GetItem`.
-For strings, :c:func:`PyString_Size` returns its length and
-:c:func:`PyString_AsString` a pointer to its value. Note that Python strings may
-contain null bytes so C's :c:func:`strlen` should not be used.
+For bytes, :c:func:`PyBytes_Size` returns its length and
+:c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its
+length. Note that Python bytes objects may contain null bytes so C's
+:c:func:`strlen` should not be used.
To test the type of an object, first make sure it isn't *NULL*, and then use
-:c:func:`PyString_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc.
+:c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc.
There is also a high-level API to Python objects which is provided by the
so-called 'abstract' interface -- read ``Include/abstract.h`` for further
details. It allows interfacing with any kind of Python sequence using calls
-like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well as
-many other useful protocols.
+like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well
+as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et.
+al.) and mappings in the PyMapping APIs.
How do I use Py_BuildValue() to create a tuple of arbitrary length?