@@ -81,7 +81,7 @@ shortly how it ends up being called)::
8181 if (!PyArg_ParseTuple(args, "s", &command))
8282 return NULL;
8383 sts = system(command);
84- return Py_BuildValue("i", sts);
84+ return PyLong_FromLong( sts);
8585 }
8686
8787There is a straightforward translation from the argument list in Python (for
@@ -274,12 +274,9 @@ the string we just got from :c:func:`PyArg_ParseTuple`::
274274 sts = system(command);
275275
276276Our :func: `spam.system ` function must return the value of :c:data: `sts ` as a
277- Python object. This is done using the function :c:func: `Py_BuildValue `, which is
278- something like the inverse of :c:func: `PyArg_ParseTuple `: it takes a format
279- string and an arbitrary number of C values, and returns a new Python object.
280- More info on :c:func: `Py_BuildValue ` is given later. ::
277+ Python object. This is done using the function :c:func: `PyLong_FromLong `. ::
281278
282- return Py_BuildValue("i", sts);
279+ return PyLong_FromLong( sts);
283280
284281In this case, it will return an integer object. (Yes, even integers are objects
285282on the heap in Python!)
@@ -1195,7 +1192,7 @@ The function :c:func:`spam_system` is modified in a trivial way::
11951192 if (!PyArg_ParseTuple(args, "s", &command))
11961193 return NULL;
11971194 sts = PySpam_System(command);
1198- return Py_BuildValue("i", sts);
1195+ return PyLong_FromLong( sts);
11991196 }
12001197
12011198In the beginning of the module, right after the line ::
0 commit comments