\begin{verbatim}
static PyObject *
-spam_system(self, args)
- PyObject *self;
- PyObject *args;
+spam_system(PyObject *self, PyObject *args)
{
char *command;
int sts;
\cfunction{Py_Initialize()} or \cfunction{PyMac_Initialize()}:
\begin{verbatim}
-int main(int argc, char **argv)
+int
+main(int argc, char *argv[])
{
/* Pass argv[0] to the Python interpreter */
Py_SetProgramName(argv[0]);
static PyObject *my_callback = NULL;
static PyObject *
-my_set_callback(dummy, args)
- PyObject *dummy, *args;
+my_set_callback(PyObject *dummy, PyObject *args)
{
PyObject *result = NULL;
PyObject *temp;
\begin{verbatim}
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
- char *format, char **kwlist, ...);
+ char *format, char *kwlist[], ...);
\end{verbatim}
The \var{arg} and \var{format} parameters are identical to those of the
#include "Python.h"
static PyObject *
-keywdarg_parrot(self, args, keywds)
- PyObject *self;
- PyObject *args;
- PyObject *keywds;
+keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
{
int voltage;
char *state = "a stiff";
reference to a list item. For instance:
\begin{verbatim}
-bug(PyObject *list) {
+void
+bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
PyList_SetItem(list, 1, PyInt_FromLong(0L));
function reads:
\begin{verbatim}
-no_bug(PyObject *list) {
+void
+no_bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
Py_INCREF(item);
problem as the previous one:
\begin{verbatim}
-bug(PyObject *list) {
+void
+bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
Py_BEGIN_ALLOW_THREADS
...some blocking I/O call...
\begin{verbatim}
static int
-PySpam_System(command)
- char *command;
+PySpam_System(char *command)
{
return system(command);
}
\begin{verbatim}
static PyObject *
-spam_system(self, args)
- PyObject *self;
- PyObject *args;
+spam_system(PyObject *self, PyObject *args)
{
char *command;
int sts;