Implementing Metatypes in C

Greg Chapman glc at well.com
Tue Apr 15 09:34:47 EDT 2003


On Mon, 14 Apr 2003 00:10:10 +0100, Phil Thompson <phil at river-bank.demon.co.uk>
wrote:

>1. Is my understanding correct, or is there a more correct way to do what I 
>want that avoids the problem?
>
>2. If my solution is correct, can the structure defined in typeobject.c be 
>published in a header file as the comment says? Please?

I believe your solution may break in 2.3a2 if subtypes declare tp_members, since
the PyMemberDefs for these are kept in the variable part of the type structure
which follows the things declared in etype.  At any rate, check out this patch
(accepted after the release of 2.3a2):

   http://www.python.org/sf/696193

which should allow you to cleanly add extra data slots to metatypes.

---
Greg Chapman





More information about the Python-list mailing list