Remove trailing whitespace.

This commit is contained in:
Georg Brandl 2009-01-03 21:18:54 +00:00
parent 3d3558a465
commit 48310cd3f2
127 changed files with 825 additions and 825 deletions

View file

@ -39,7 +39,7 @@ Python file, which, in the most simple case, could look like this::
With this :file:`setup.py`, and a file :file:`demo.c`, running ::
python setup.py build
python setup.py build
will compile :file:`demo.c`, and produce an extension module named ``demo`` in
the :file:`build` directory. Depending on the system, the module file will end

View file

@ -334,7 +334,7 @@ When the Python program imports module :mod:`spam` for the first time,
:cfunc:`PyInit_spam` is called. (See below for comments about embedding Python.)
It calls :cfunc:`PyModule_Create`, which returns a module object, and
inserts built-in function objects into the newly created module based upon the
table (an array of :ctype:`PyMethodDef` structures) found in the module definition.
table (an array of :ctype:`PyMethodDef` structures) found in the module definition.
:cfunc:`PyModule_Create` returns a pointer to the module object
that it creates. It may abort with a fatal error for
certain errors, or return *NULL* if the module could not be initialized
@ -482,7 +482,7 @@ Later, when it is time to call the function, you call the C function
:cfunc:`PyEval_CallObject`. This function has two arguments, both pointers to
arbitrary Python objects: the Python function, and the argument list. The
argument list must always be a tuple object, whose length is the number of
arguments. To call the Python function with no arguments, pass in NULL, or
arguments. To call the Python function with no arguments, pass in NULL, or
an empty tuple; to call it with one argument, pass a singleton tuple.
:cfunc:`Py_BuildValue` returns a tuple when its format string consists of zero
or more format codes between parentheses. For example::
@ -521,7 +521,7 @@ If this is not possible or desirable, the exception should be cleared by calling
if (result == NULL)
return NULL; /* Pass error back */
...use result...
Py_DECREF(result);
Py_DECREF(result);
Depending on the desired interface to the Python callback function, you may also
have to provide an argument list to :cfunc:`PyEval_CallObject`. In some cases
@ -546,7 +546,7 @@ Note the placement of ``Py_DECREF(arglist)`` immediately after the call, before
the error check! Also note that strictly speaking this code is not complete:
:cfunc:`Py_BuildValue` may run out of memory, and this should be checked.
You may also call a function with keyword arguments by using
You may also call a function with keyword arguments by using
:cfunc:`PyEval_CallObjectWithKeywords`. As in the above example, we use
:cfunc:`Py_BuildValue` to construct the dictionary. ::
@ -687,7 +687,7 @@ Philbrick (philbrick@hks.com)::
static PyObject *
keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
{
{
int voltage;
char *state = "a stiff";
char *action = "voom";
@ -695,11 +695,11 @@ Philbrick (philbrick@hks.com)::
static char *kwlist[] = {"voltage", "state", "action", "type", NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|sss", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|sss", kwlist,
&voltage, &state, &action, &type))
return NULL;
return NULL;
printf("-- This parrot wouldn't %s if you put %i Volts through it.\n",
printf("-- This parrot wouldn't %s if you put %i Volts through it.\n",
action, voltage);
printf("-- Lovely plumage, the %s -- It's %s!\n", type, state);

View file

@ -1180,7 +1180,7 @@ As with the :attr:`tp_methods` table, a sentinel entry with a :attr:`name` value
of *NULL* is required.
.. XXX Descriptors need to be explained in more detail somewhere, but not here.
Descriptor objects have two handler functions which correspond to the
\member{tp_getattro} and \member{tp_setattro} handlers. The
\method{__get__()} handler is a function which is passed the descriptor,
@ -1233,15 +1233,15 @@ example that simply raises an exception; if this were really all you wanted, the
return -1;
}
.. XXX tp_compare is dead; need to rewrite for tp_richcompare!
.. XXX tp_compare is dead; need to rewrite for tp_richcompare!
Object Comparison
-----------------
::
cmpfunc tp_compare;
The :attr:`tp_compare` handler is called when comparisons are needed and the
object does not implement the specific rich comparison method which matches the
requested comparison. (It is always used if defined and the
@ -1252,18 +1252,18 @@ example that simply raises an exception; if this were really all you wanted, the
allowed to return arbitrary negative or positive integers for less than and
greater than, respectively; as of Python 2.2, this is no longer allowed. In the
future, other return values may be assigned a different meaning.)
A :attr:`tp_compare` handler may raise an exception. In this case it should
return a negative value. The caller has to test for the exception using
:cfunc:`PyErr_Occurred`.
Here is a sample implementation::
static int
newdatatype_compare(newdatatypeobject * obj1, newdatatypeobject * obj2)
{
long result;
if (obj1->obj_UnderlyingDatatypePtr->size <
obj2->obj_UnderlyingDatatypePtr->size) {
result = -1;

View file

@ -102,7 +102,7 @@ described here are distributed with the Python sources in the
and it should call :cfunc:`Py_InitModule` with the string ``"spam"`` as its
first argument (use the minimal :file:`example.c` in this directory as a guide).
By convention, it lives in a file called :file:`spam.c` or :file:`spammodule.c`.
The output file should be called :file:`spam.pyd` (in Release mode) or
The output file should be called :file:`spam.pyd` (in Release mode) or
:file:`spam_d.pyd` (in Debug mode). The extension :file:`.pyd` was chosen
to avoid confusion with a system library :file:`spam.dll` to which your module
could be a Python interface.