[Python-checkins] python/dist/src/Include object.h,2.112,2.113
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 07 Mar 2003 07:13:50 -0800
Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv3464/Include
Modified Files:
object.h
Log Message:
- The extended type structure used for heap types (new-style
classes defined by Python code using a class statement) is now
exported from object.h as PyHeapTypeObject. (SF patch #696193.)
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.112
retrieving revision 2.113
diff -C2 -d -r2.112 -r2.113
*** object.h 17 Nov 2002 17:52:44 -0000 2.112
--- object.h 7 Mar 2003 15:13:16 -0000 2.113
***************
*** 328,331 ****
--- 328,353 ----
+ /* The *real* layout of a type object when allocated on the heap */
+ typedef struct _heaptypeobject {
+ /* Note: there's a dependency on the order of these members
+ in slotptr() in typeobject.c . */
+ PyTypeObject type;
+ PyNumberMethods as_number;
+ PyMappingMethods as_mapping;
+ PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
+ so that the mapping wins when both
+ the mapping and the sequence define
+ a given operator (e.g. __getitem__).
+ see add_operators() in typeobject.c . */
+ PyBufferProcs as_buffer;
+ PyObject *name, *slots;
+ /* here are optional user slots, followed by the members. */
+ } PyHeapTypeObject;
+
+ /* access macro to the members which are floating "behind" the object */
+ #define PyHeapType_GET_MEMBERS(etype) \
+ ((PyMemberDef *)(((char *)etype) + (etype)->type.ob_type->tp_basicsize))
+
+
/* Generic type check */
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);