Implementing Metatypes in C

Phil Thompson phil at river-bank.demon.co.uk
Tue Apr 15 15:49:23 CEST 2003


On Tuesday 15 April 2003 2:34 pm, Greg Chapman wrote:
> 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.

I have a temporary hack in place based on the current CVS version (which 
includes the above patch) which I can remove once 2.3b1 is released.

Phil





More information about the Python-list mailing list