[Python-3000] Draft PEP: Dropping PyObject_HEAD

"Martin v. Löwis" martin at v.loewis.de
Mon Apr 30 07:12:28 CEST 2007


>> That doesn't work. For variable-sized objects, it would need
>> to be ob_base.ob_base.ob_type.
> 
> I was wondering about that. It seems that each level
> of inheritance is going to add another level of
> required member access. Or is it legal to short-
> circuit all that and just cast directly to the
> ultimate base object?

As the PEP explains: you can cast a struct pointer to pointer
to the first field. That works recursively: if the first field
is a struct again, you can also cast to a pointer to that
struct's first field.

Regards,
Martin


More information about the Python-3000 mailing list