[Python-Dev] Re: Advanced C Types

Pete Shinners pete at shinners.org
Fri Jul 2 17:24:26 CEST 2004


Michael Hudson wrote:
> Um.  What am I missing that makes this not totally pointless?  The
> "instance PyObject*" *is* the "base type's PyObject* data".  Cast it.

If this is the case, then terrific. I didn't think it could be since the 
PyObject must have to be a PyClassObject, and not PyMyBaseObject. I'm 
still working with it all, so I'll test this out. If this just works I 
am in good shape.

> Hmm, not sure about that.  Have you looked at xxsubtype in the Python
> source? 

No, but thanks for this tip, this is great! It is tucked into the 
Modules directory.

>>I feel wrong digging into my PyTypeObject for various tp_
>>pointers. 
> 
> Why?

Up until tp_alloc, and tp_init, there was a PyObject_MACRO or 
PyObject_Function to deal with these for me. I've never once before 
looked inside the PyTypeObject itself. It just seems strange to start 
doing it now. That's what makes me feel I am not doing something right. 
but if that is correct, I will access with confidence (like the pros).




More information about the Python-Dev mailing list