Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc12ec8

Browse files
committed
Fix a number of typos and small grammatical nits pointed out by Detlef
Lannert <[email protected]>. Added a comment explaining the cast in the method table for the keyword arguments sample code, in response to another comment by Detlef.
1 parent 496bc7f commit dc12ec8

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

Doc/ext/ext.tex

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ \section{Intermezzo: Errors and Exceptions
255255
should probably be \cdata{PyExc_IOError}). If something's wrong with
256256
the argument list, the \cfunction{PyArg_ParseTuple()} function usually
257257
raises \cdata{PyExc_TypeError}. If you have an argument whose value
258-
which must be in a particular range or must satisfy other conditions,
258+
must be in a particular range or must satisfy other conditions,
259259
\cdata{PyExc_ValueError} is appropriate.
260260

261261
You can also define a new exception that is unique to your module.
@@ -380,7 +380,7 @@ \section{The Module's Method Table and Initialization Function
380380
arguments should be passed to the function. In this case, the C
381381
function should accept a third \samp{PyObject *} parameter which will
382382
be a dictionary of keywords. Use \cfunction{PyArg_ParseTupleAndKeywords()}
383-
to parse the arguemts to such a function.
383+
to parse the arguments to such a function.
384384

385385
The method table must be passed to the interpreter in the module's
386386
initialization function (which should be the only non-\code{static}
@@ -462,7 +462,7 @@ \section{Calling Python Functions from C
462462
somehow pass you the Python function object. You should provide a
463463
function (or some other interface) to do this. When this function is
464464
called, save a pointer to the Python function object (be careful to
465-
\cfunction{Py_INCREF()} it!) in a global variable --- or whereever you
465+
\cfunction{Py_INCREF()} it!) in a global variable --- or wherever you
466466
see fit. For example, the following function might be part of a module
467467
definition:
468468

@@ -719,7 +719,7 @@ \section{Format Strings for \cfunction{PyArg_ParseTuple()}
719719
requested; however no proper range checking is done --- the most
720720
significant bits are silently truncated when the receiving field is
721721
too small to receive the value (actually, the semantics are inherited
722-
from downcasts in C --- your milage may vary).
722+
from downcasts in C --- your mileage may vary).
723723

724724
A few other characters have a meaning in a format string. These may
725725
not occur inside nested parentheses. They are:
@@ -736,7 +736,7 @@ \section{Format Strings for \cfunction{PyArg_ParseTuple()}
736736
\item[\samp{:}]
737737
The list of format units ends here; the string after the colon is used
738738
as the function name in error messages (the ``associated value'' of
739-
the exceptions that \cfunction{PyArg_ParseTuple()} raises).
739+
the exception that \cfunction{PyArg_ParseTuple()} raises).
740740

741741
\item[\samp{;}]
742742
The list of format units ends here; the string after the colon is used
@@ -866,6 +866,10 @@ \section{Keyword Parsing with \cfunction{PyArg_ParseTupleAndKeywords()}
866866
}
867867
868868
static PyMethodDef keywdarg_methods[] = {
869+
/* The cast of the function is necessary since PyCFunction values
870+
* only take two PyObject* parameters, and keywdarg_parrot() takes
871+
* three.
872+
*/
869873
{"parrot", (PyCFunction)keywdarg_parrot, METH_VARARGS|METH_KEYWORDS},
870874
{NULL, NULL} /* sentinel */
871875
};
@@ -1605,9 +1609,9 @@ \chapter{Building C and \Cpp{} Extensions on \UNIX{}
16051609
\end{verbatim}
16061610

16071611
to indicate that the modules defined in \file{Setup} are to be built
1608-
as dynamically-linked linked modules. A line containing only
1609-
\samp{*static*} can be used to indicate the subsequently listed
1610-
modules should be statically linked.
1612+
as dynamically linked modules. A line containing only \samp{*static*}
1613+
can be used to indicate the subsequently listed modules should be
1614+
statically linked.
16111615

16121616
Here is a complete \file{Setup} file for building a
16131617
\module{cPersistent} module:
@@ -1672,7 +1676,7 @@ \section{Module Definition Options \label{module-defn-options}}
16721676
\end{tableii}
16731677

16741678
Other compiler options can be included (snuck in) by putting them
1675-
in variable variables.
1679+
in variables.
16761680

16771681
Source files can include files with \file{.c}, \file{.C}, \file{.cc},
16781682
\file{.cpp}, \file{.cxx}, and \file{.c++} extensions.

0 commit comments

Comments
 (0)