Commit Graph

179 Commits

Author SHA1 Message Date
Raymond Hettinger 8fb665a51a Fix ref counts in initialization code. 2003-05-25 17:59:38 +00:00
Raymond Hettinger f9c2eda3c1 Fix missing parethesis. 2003-05-20 05:31:16 +00:00
Raymond Hettinger 047c54bb24 Missing parenthesis. 2003-05-16 14:36:26 +00:00
Jim Fulton 1f325562f0 Added some missing PyObject* casts in the deallocators.
Added some defines for PyMODINIT_FUNC so that the examples work
with Python 2.2.

I think I'm done hacking this documentation. Yippie! :)
2003-05-16 13:53:43 +00:00
Jim Fulton a24d73ddb1 Added a missing PyObject* cast to the dealloc examples.
Added a note that the mechanism for defining new tyoes documented here
only works for Python 2.2 and higher.
2003-05-16 13:51:58 +00:00
Jim Fulton aea763bde7 Removed reference to the out-of-date (and not very useful)
Objects/xxobject.c example.

Updated the discussion of type checking to refer to
PyObject_TypeCheck.
2003-05-16 13:32:59 +00:00
Jim Fulton d2eadc6946 Updated simple example. This should have been checked in the other
day, but I missfired in CVS.
2003-05-12 17:42:56 +00:00
Jim Fulton 3ff5bb20b7 Fixed small typo Pointed out by Michael Hudson. 2003-05-08 10:35:07 +00:00
Jim Fulton 83cedcf660 Fixed a typo in an example dealloc routine that calls it's "self"
argument "obj" rather than "self".
2003-05-08 10:32:10 +00:00
Jim Fulton aed0a4a138 Rewrote the basic section of the chapter on defining new types.
Changed the example to show how to create types the new way:

- Use a class new method rather than a new function.

- Use self->ob_type->tp_free in deallocators

- Use attribute descriptors rather than set/getattr methods.

- Make the type usable as a base type.

I split the example into 3 parts:

1. The minimal new type

2. Adding attributes and methods.

3. Finer control over attributes.

It's much simpler to define builtin types. These updates hopefully
show this.

I also made minor wording changes in two other places.

I still need to update xxobject.c
2003-05-07 19:48:13 +00:00
Michael W. Hudson 241c2e9692 Remove another lie. 2003-02-06 18:38:11 +00:00
Greg Ward d4fee28717 Rewrite awkward/ungrammatical sentence.
Typo fix.
2003-01-08 03:02:26 +00:00
Greg Ward fdf65d9106 Grammatical fix: change possessive "it's" to "its". 2003-01-03 21:09:57 +00:00
Greg Ward 3ebf56c60f Two more typo fixes. 2002-12-17 23:27:41 +00:00
Greg Ward 1d5d8cf61f Typo fix. 2002-12-17 18:14:21 +00:00
Neal Norwitz 0f30dbd991 Fix SF # 626275, missing DECREF's in embedding example
Tested w/valgrind, all paths except the return on PyInt_AsLong() failure
I think I got all of these right.

Backport candidate.
2002-12-17 00:40:38 +00:00
Neal Norwitz 75bc8ba0d7 Fix SF # 646578, Documentation Typo 2002-12-02 04:42:58 +00:00
Neal Norwitz ae6bf4adfa Remove unused variable 2002-12-02 04:40:21 +00:00
Fred Drake cc6cc5ddff Fix minor markup nits. 2002-11-05 16:52:50 +00:00
Greg Ward 373198e751 Fix peculiar (and ungrammatical) wording in an example program. 2002-08-22 19:15:35 +00:00
Mark Hammond 543fb35cca Replace DL_EXPORT with PyMODINIT_FUNC 2002-07-31 06:17:46 +00:00
Mark Hammond 8235ea1c3a Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. 2002-07-19 06:55:41 +00:00
Fred Drake 50ceb68b4f Change staticforward and statichere to just use static.
Removed ^M from some line-ends.
2002-07-17 16:42:48 +00:00
Fred Drake a3cd9bbaa3 Remove now-obsolete staticforward/statichere discussion. 2002-07-17 16:40:39 +00:00
Thomas Heller 291e9ee341 Fix a typo. 2002-07-04 08:36:53 +00:00
Fred Drake 723f94bd66 Convert the example C code to ANSI rather than K&R.
This matches the Python C style guide (PEP 7).
Closes SF patch #571489.
2002-06-22 01:42:00 +00:00
Greg Ward 6f45eeb0f3 Typo fix. 2002-06-21 12:33:08 +00:00
Guido van Rossum 18ca791028 Typo. 2002-05-16 14:45:37 +00:00
Fred Drake 4e7655558c Fix broken reference, minor clarification. 2002-05-16 13:48:14 +00:00
Fred Drake 742dc774af Typo: build -> built 2002-05-16 13:48:01 +00:00
Fred Drake 9aa97e835d Minor wording changes, plus correct a typo. 2002-05-14 22:02:07 +00:00
Fred Drake c55ae4b98c Clean up the use of version numbers in filenames; always use an "abstract"
version number, and explain what it is at the top of the chapter.
This closes SF bug #225003.
2002-04-19 04:04:57 +00:00
Fred Drake c63042bcc4 Move the listing of the type structure, since both the C API reference and
the Extending & Embedding manual use it.
2002-04-15 18:43:20 +00:00
Fred Drake fd92304ae8 Update the type of the tp_free slot. 2002-04-12 19:49:13 +00:00
Fred Drake 63e40a598d Do not use PyModule_GetDict().
Clean up the example of exporting a C-callable API from an extension module.
Add a hyperlink to a related section in the Python/C API reference.
2002-04-12 19:08:31 +00:00
Fred Drake e77e5ef2af Change example of retrieving & calling a Python function to not use
PyModule_GetDict(), which is also more flexible: it does not assume that the
"module" is a real module.
2002-04-12 19:04:17 +00:00
Fred Drake 292da58a5c Change the type of the tp_dealloc back to what it really is.
Change a section title to fit in better.
2002-04-12 18:28:08 +00:00
Fred Drake ee48519bc6 Modernize the minimal example of an extension type. 2002-04-12 16:17:06 +00:00
Fred Drake 0babc44ab2 Update the type of tp_dealloc. 2002-04-12 15:37:43 +00:00
Fred Drake 375e30225e Update to use the new \csimplemacro macro 2002-04-09 21:09:42 +00:00
Fred Drake 68304ccce3 Move reference material on PyArg_Parse*() out of the Extending & Embedding
document to the C API reference.  Move some instructional text from the API
reference to the Extending & Embedding manual.

Fix the descriptions of the es and es# formats for PyArg_Parse*().
This closes SF bug #536516.
2002-04-05 23:01:14 +00:00
Fred Drake 9651198db4 Remove weird spacing in typeset version of the chapter head. 2002-04-05 19:54:19 +00:00
Fred Drake 103b548a76 Add a note warning against semicolons following PyObject_HEAD.
Minor cleanups.
2002-04-02 15:42:46 +00:00
Fred Drake d764b0a484 There is no PyArg_ConvertTuple(); call it by the right name.
This closes SF bug #537511.
2002-04-01 23:12:25 +00:00
Fred Drake fe5a5388c3 Use the right types for a couple of fields of the type structure. 2002-03-29 22:46:04 +00:00
Fred Drake 0ffd14c9ea Started updating information about defining attributes on types.
There's still a long way to go, but we're starting to see some real
content in the docs.
2002-03-29 22:45:28 +00:00
Fred Drake b1af6376e9 Mark a couple of types that had not been marked. 2002-03-28 23:46:41 +00:00
Fred Drake 0f9a34da2c Added comments for more entries of the type structure in the example
type implementation.
2002-03-28 23:45:22 +00:00
Fred Drake 2ab0a10913 The new files included by \verbatiminput in newtypes.tex. 2002-03-28 23:32:53 +00:00
Fred Drake 81b750d467 Move some of the longer example code to external fragments, and
include them using \verbatiminput.  This has the advantage that pages
can still break at reasonable places, and examples that go longer than
a page won't get cut off.

Make a few small markup adjustments for consistency.

Explain that PyObject_New() is not a C function but a polymorphic
beast that returns a pointer to the type that's passed as the first
arg.

Explain why type objects use the PyObject_VAR_HEAD.
2002-03-28 23:12:09 +00:00