[Python-checkins] python/dist/src/Objects typeobject.c,2.145,2.146
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
2002年5月24日 14:38:50 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv3811a
Modified Files:
typeobject.c
Log Message:
Fix for SF bug 551412. When _PyType_Lookup() is called on a type
whose tp_mro hasn't been initialized, it would dump core. Fix this by
checking for NULL and calling PyType_Ready(). Will fix this in 2.2.1
too.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.145
retrieving revision 2.146
diff -C2 -d -r2.145 -r2.146
*** typeobject.c 24 May 2002 18:47:47 -0000 2.145
--- typeobject.c 24 May 2002 21:38:46 -0000 2.146
***************
*** 1222,1225 ****
--- 1222,1231 ----
/* Look in tp_dict of types in MRO */
mro = type->tp_mro;
+ if (mro == NULL) {
+ if (PyType_Ready(type) < 0)
+ return NULL;
+ mro = type->tp_mro;
+ assert(mro != NULL);
+ }
assert(PyTuple_Check(mro));
n = PyTuple_GET_SIZE(mro);