Commit Graph

5 Commits

Author SHA1 Message Date
Jim Fulton 7a0e8bc283 Updated documentation to:
- point out the importance of reassigning data members before
  assigning thier values

- correct my missconception about return values from visitprocs. Sigh.

- mention the labor saving Py_VISIT and Py_CLEAR macros.
2004-07-14 19:07:24 +00:00
Jim Fulton 7050e929e6 Fixed bug in implementation of tp_init function. It should be an int
function, not a PyObject *.
2003-06-28 11:54:03 +00:00
Raymond Hettinger 8fb665a51a Fix ref counts in initialization code. 2003-05-25 17:59:38 +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 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