Recorded merge of revisions 86795,86798-86799,86801 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
r86795 | georg.brandl | 2010-11-26 12:55:48 +0100 (Fr, 26 Nov 2010) | 1 line
Use PyLong_FromLong where appropriate.
........
r86798 | georg.brandl | 2010-11-26 13:05:48 +0100 (Fr, 26 Nov 2010) | 1 line
#10420: fix docs of bdb.effective().
........
r86799 | georg.brandl | 2010-11-26 13:08:19 +0100 (Fr, 26 Nov 2010) | 1 line
Remove parenthetical remark that is confusing now that the module is not named "__builtin__" anymore.
........
r86801 | georg.brandl | 2010-11-26 13:12:14 +0100 (Fr, 26 Nov 2010) | 1 line
Better example for os.system(): do not change the system time.
........
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index af983b3..83fa520 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -74,7 +74,7 @@
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
- return Py_BuildValue("i", sts);
+ return PyLong_FromLong(sts);
}
There is a straightforward translation from the argument list in Python (for
@@ -266,13 +266,10 @@
sts = system(command);
-Our :func:`spam.system` function must return the value of :cdata:`sts` as a
-Python object. This is done using the function :cfunc:`Py_BuildValue`, which is
-something like the inverse of :cfunc:`PyArg_ParseTuple`: it takes a format
-string and an arbitrary number of C values, and returns a new Python object.
-More info on :cfunc:`Py_BuildValue` is given later. ::
+Our :func:`spam.system` function must return the value of :c:data:`sts` as a
+Python object. This is done using the function :cfunc:`PyLong_FromLong`. ::
- return Py_BuildValue("i", sts);
+ return PyLong_FromLong(sts);
In this case, it will return an integer object. (Yes, even integers are objects
on the heap in Python!)
@@ -1193,7 +1190,7 @@
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = PySpam_System(command);
- return Py_BuildValue("i", sts);
+ return PyLong_FromLong(sts);
}
In the beginning of the module, right after the line ::