summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-03 21:30:19 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-03 21:30:19 (GMT)
commit48383bfc67438b0e280be732a13dbc77a8dceb8e (patch)
treec7f0ae52f5f5d953380291e31ae38bdb4ab50752 /Doc
parentf35204055e5c514a1eb3b1948366743269d1ec90 (diff)
downloadcpython-48383bfc67438b0e280be732a13dbc77a8dceb8e.zip
cpython-48383bfc67438b0e280be732a13dbc77a8dceb8e.tar.gz
cpython-48383bfc67438b0e280be732a13dbc77a8dceb8e.tar.bz2
Advocate PyTuple_Pack instead of manual building of tuples
Diffstat (limited to 'Doc')
-rw-r--r--Doc/faq/extending.rst7
1 files changed, 1 insertions, 6 deletions
diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst
index d880564..676890e 100644
--- a/Doc/faq/extending.rst
+++ b/Doc/faq/extending.rst
@@ -99,12 +99,7 @@ many other useful protocols.
How do I use Py_BuildValue() to create a tuple of arbitrary length?
-------------------------------------------------------------------
-You can't. Use ``t = PyTuple_New(n)`` instead, and fill it with objects using
-``PyTuple_SetItem(t, i, o)`` -- note that this "eats" a reference count of
-``o``, so you have to :c:func:`Py_INCREF` it. Lists have similar functions
-``PyList_New(n)`` and ``PyList_SetItem(l, i, o)``. Note that you *must* set all
-the tuple items to some value before you pass the tuple to Python code --
-``PyTuple_New(n)`` initializes them to NULL, which isn't a valid Python value.
+You can't. Use :c:func:`PyTuple_Pack` instead.
How do I call an object's method from C?