[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.126.4.6,2.126.4.7
Guido van Rossum
gvanrossum@users.sourceforge.net
Sun, 07 Apr 2002 18:39:58 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv16741/Objects
Modified Files:
Tag: release22-maint
typeobject.c
Log Message:
- A type can now inherit its metatype from its base type. Previously,
when PyType_Ready() was called, if ob_type was found to be NULL, it
was always set to &PyType_Type; now it is set to base->ob_type,
where base is tp_base, defaulting to &PyObject_Type.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.6
retrieving revision 2.126.4.7
diff -C2 -d -r2.126.4.6 -r2.126.4.7
*** typeobject.c 5 Apr 2002 22:29:43 -0000 2.126.4.6
--- typeobject.c 8 Apr 2002 01:39:56 -0000 2.126.4.7
***************
*** 2003,2016 ****
type->tp_flags |= Py_TPFLAGS_READYING;
- /* Initialize ob_type if NULL. This means extensions that want to be
- compilable separately on Windows can call PyType_Ready() instead of
- initializing the ob_type field of their type objects. */
- if (type->ob_type == NULL)
- type->ob_type = &PyType_Type;
-
/* Initialize tp_base (defaults to BaseObject unless that's us) */
base = type->tp_base;
if (base == NULL && type != &PyBaseObject_Type)
base = type->tp_base = &PyBaseObject_Type;
/* Initialize tp_bases */
--- 2003,2016 ----
type->tp_flags |= Py_TPFLAGS_READYING;
/* Initialize tp_base (defaults to BaseObject unless that's us) */
base = type->tp_base;
if (base == NULL && type != &PyBaseObject_Type)
base = type->tp_base = &PyBaseObject_Type;
+
+ /* Initialize ob_type if NULL. This means extensions that want to be
+ compilable separately on Windows can call PyType_Ready() instead of
+ initializing the ob_type field of their type objects. */
+ if (type->ob_type == NULL)
+ type->ob_type = base->ob_type;
/* Initialize tp_bases */