[Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.10,2.126.4.11

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 24 May 2002 14:41:28 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv4469

Modified Files:
      Tag: release22-maint
	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().  Backport from 2.3.


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.10
retrieving revision 2.126.4.11
diff -C2 -d -r2.126.4.10 -r2.126.4.11
*** typeobject.c	18 Apr 2002 05:11:50 -0000	2.126.4.10
--- typeobject.c	24 May 2002 21:41:26 -0000	2.126.4.11
***************
*** 1219,1222 ****
--- 1219,1228 ----
  	/* 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);