sizeof PyTypeObject difference

Christian Tismer tismer at tismer.com
Thu Oct 10 01:59:20 CEST 2002


Tom Widrick wrote:
...

>>You can't currently declare a type with additional C fields, since
>>type objects are variable-sized. One approach is to put additional
>>things into the type's __dict__. Another approach is to use Christian
>>Tismer's patches to overcome this limitation; I recommend that you
>>contact Christian.
> 
> 
> Thanks for the info on that one. Very helpful. Wish that was stuck in PEP
> 253.
> 
> As an aside, are there any other quarks about making metatypes in C? the
> xxsubtype.c example in the distrib is helpful, along with the PEPs, but I'm
> yet to find a good example of a metatype implemented in C (besides the 2
> builtin metatypes, but I don't think those serve as  great minimalistic
> examples).

If you're heading for a real example, check out the
Stackless sources. There I'm using extension types
all the time (with my flextype type). What you
would need would be my version of typeobject.c,
together with flextype.c/h . This allows you to
extend type to any extent, and it has a simple mechanism
built in to use virtual methods very efficiently,
regardless whether they are written in C or Python.

Would be great to have more than one user (me),
since it would lead to a better interface. (Kept
everything as simple as possible since I thought
this would go into Standard Python
  - pointless optimism, should have known better!-)

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/






More information about the Python-list mailing list