diff options
author | Georg Brandl <georg@python.org> | 2009-01-03 21:55:17 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-03 21:55:17 (GMT) |
commit | 734373cc4dfe81da12674b2f5a801ff14a5ebfe3 (patch) | |
tree | 353daaf1d6004adc26631a22ae31ca655eb966c0 /Doc/extending | |
parent | 9b520efa8f4cebf9ecac41ccb529b9894c5cef95 (diff) | |
download | cpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.zip cpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.tar.gz cpython-734373cc4dfe81da12674b2f5a801ff14a5ebfe3.tar.bz2 |
Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68133 | antoine.pitrou | 2009-01-01 16:38:03 +0100 (Thu, 01 Jan 2009) | 1 line
fill in actual issue number in tests
........
r68134 | hirokazu.yamamoto | 2009-01-01 16:45:39 +0100 (Thu, 01 Jan 2009) | 2 lines
Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
file with `str' filename on Windows.
........
r68141 | benjamin.peterson | 2009-01-01 17:43:12 +0100 (Thu, 01 Jan 2009) | 1 line
fix highlighting
........
r68142 | benjamin.peterson | 2009-01-01 18:29:49 +0100 (Thu, 01 Jan 2009) | 2 lines
welcome to 2009, Python!
........
r68145 | amaury.forgeotdarc | 2009-01-02 01:03:54 +0100 (Fri, 02 Jan 2009) | 5 lines
#4801 _collections module fails to build on cygwin.
_PyObject_GC_TRACK is the macro version of PyObject_GC_Track,
and according to documentation it should not be used for extension modules.
........
r68146 | ronald.oussoren | 2009-01-02 11:44:46 +0100 (Fri, 02 Jan 2009) | 2 lines
Fix for issue4472: "configure --enable-shared doesn't work on OSX"
........
r68148 | ronald.oussoren | 2009-01-02 11:48:31 +0100 (Fri, 02 Jan 2009) | 2 lines
Forgot to add a NEWS item in my previous checkin
........
r68149 | ronald.oussoren | 2009-01-02 11:50:48 +0100 (Fri, 02 Jan 2009) | 2 lines
Fix for issue4780
........
r68159 | ronald.oussoren | 2009-01-02 15:48:17 +0100 (Fri, 02 Jan 2009) | 2 lines
Fix for issue 1627952
........
r68160 | ronald.oussoren | 2009-01-02 15:52:09 +0100 (Fri, 02 Jan 2009) | 2 lines
Fix for issue r1737832
........
r68161 | ronald.oussoren | 2009-01-02 16:00:05 +0100 (Fri, 02 Jan 2009) | 3 lines
Fix for issue 1149804
........
r68162 | ronald.oussoren | 2009-01-02 16:06:00 +0100 (Fri, 02 Jan 2009) | 3 lines
Fix for issue 4472 is incompatible with Cygwin, this patch
should fix that.
........
r68166 | benjamin.peterson | 2009-01-02 19:26:23 +0100 (Fri, 02 Jan 2009) | 1 line
document PyMemberDef
........
r68171 | georg.brandl | 2009-01-02 21:25:14 +0100 (Fri, 02 Jan 2009) | 3 lines
#4811: fix markup glitches (mostly remains of the conversion),
found by Gabriel Genellina.
........
r68172 | martin.v.loewis | 2009-01-02 21:32:55 +0100 (Fri, 02 Jan 2009) | 2 lines
Issue #4075: Use OutputDebugStringW in Py_FatalError.
........
r68173 | martin.v.loewis | 2009-01-02 21:40:14 +0100 (Fri, 02 Jan 2009) | 2 lines
Issue #4051: Prevent conflict of UNICODE macros in cPickle.
........
r68174 | benjamin.peterson | 2009-01-02 21:47:27 +0100 (Fri, 02 Jan 2009) | 1 line
fix compilation on non-Windows platforms
........
r68179 | raymond.hettinger | 2009-01-02 22:26:45 +0100 (Fri, 02 Jan 2009) | 1 line
Issue #4615. Document how to use itertools for de-duping.
........
r68195 | georg.brandl | 2009-01-03 14:45:15 +0100 (Sat, 03 Jan 2009) | 2 lines
Remove useless string literal.
........
r68196 | georg.brandl | 2009-01-03 15:29:53 +0100 (Sat, 03 Jan 2009) | 2 lines
Fix indentation.
........
r68210 | georg.brandl | 2009-01-03 20:10:12 +0100 (Sat, 03 Jan 2009) | 2 lines
Set eol-style correctly for mp_distributing.py.
........
r68214 | georg.brandl | 2009-01-03 20:44:48 +0100 (Sat, 03 Jan 2009) | 2 lines
Make indentation consistent.
........
r68215 | georg.brandl | 2009-01-03 21:15:14 +0100 (Sat, 03 Jan 2009) | 2 lines
Fix role name.
........
r68217 | georg.brandl | 2009-01-03 21:30:15 +0100 (Sat, 03 Jan 2009) | 2 lines
Add rstlint, a little tool to find subtle markup problems and inconsistencies in the Doc sources.
........
r68218 | georg.brandl | 2009-01-03 21:38:59 +0100 (Sat, 03 Jan 2009) | 2 lines
Recognize usage of the default role.
........
r68219 | georg.brandl | 2009-01-03 21:47:01 +0100 (Sat, 03 Jan 2009) | 2 lines
Fix uses of the default role.
........
r68220 | georg.brandl | 2009-01-03 21:55:06 +0100 (Sat, 03 Jan 2009) | 2 lines
Remove trailing whitespace.
........
r68221 | georg.brandl | 2009-01-03 22:04:55 +0100 (Sat, 03 Jan 2009) | 2 lines
Remove tabs from the documentation.
........
r68222 | georg.brandl | 2009-01-03 22:11:58 +0100 (Sat, 03 Jan 2009) | 2 lines
Disable the line length checker by default.
........
Diffstat (limited to 'Doc/extending')
-rw-r--r-- | Doc/extending/building.rst | 2 | ||||
-rw-r--r-- | Doc/extending/extending.rst | 14 | ||||
-rw-r--r-- | Doc/extending/newtypes.rst | 34 | ||||
-rw-r--r-- | Doc/extending/windows.rst | 2 |
4 files changed, 26 insertions, 26 deletions
diff --git a/Doc/extending/building.rst b/Doc/extending/building.rst index 1c7b53f..f4d95b2 100644 --- a/Doc/extending/building.rst +++ b/Doc/extending/building.rst @@ -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 diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index 8c2268e..8e45384 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -471,7 +471,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:: @@ -510,7 +510,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 @@ -535,7 +535,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. :: @@ -671,7 +671,7 @@ Philbrick (philbrick@hks.com):: static PyObject * keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds) - { + { int voltage; char *state = "a stiff"; char *action = "voom"; @@ -679,11 +679,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); diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index ba39951..030de57 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -840,8 +840,8 @@ As you can see, the source code closely resembles the :class:`Noddy` examples in previous sections. We will break down the main differences between them. :: typedef struct { - PyListObject list; - int state; + PyListObject list; + int state; } Shoddy; The primary difference for derived type objects is that the base type's object @@ -854,10 +854,10 @@ be safely cast to both *PyListObject\** and *Shoddy\**. :: static int Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds) { - if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0) - return -1; - self->state = 0; - return 0; + if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0) + return -1; + self->state = 0; + return 0; } In the :attr:`__init__` method for our type, we can see how to call through to @@ -876,18 +876,18 @@ the module's :cfunc:`init` function. :: PyMODINIT_FUNC initshoddy(void) { - PyObject *m; + PyObject *m; - ShoddyType.tp_base = &PyList_Type; - if (PyType_Ready(&ShoddyType) < 0) - return; + ShoddyType.tp_base = &PyList_Type; + if (PyType_Ready(&ShoddyType) < 0) + return; - m = Py_InitModule3("shoddy", NULL, "Shoddy module"); - if (m == NULL) - return; + m = Py_InitModule3("shoddy", NULL, "Shoddy module"); + if (m == NULL) + return; - Py_INCREF(&ShoddyType); - PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); + Py_INCREF(&ShoddyType); + PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); } Before calling :cfunc:`PyType_Ready`, the type structure must have the @@ -1167,7 +1167,7 @@ structure:: typedef struct PyMethodDef { char *ml_name; /* method name */ PyCFunction ml_meth; /* implementation function */ - int ml_flags; /* flags */ + int ml_flags; /* flags */ char *ml_doc; /* docstring */ } PyMethodDef; @@ -1234,7 +1234,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, diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst index 1675a0d..aac1d2d 100644 --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -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. |