[Python-checkins] python/dist/src/Objects typeobject.c,2.146,2.147

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 03 Jun 2002 12:52:44 -0700


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

Modified Files:
	typeobject.c 
Log Message:
Address the residual issue with the fix for SF 551412 in
_PyType_Lookup().  Decided to clear the error condition in the
unfortunate but unlikely case that PyType_Ready() fails.

Will fix in 2.2.x too.


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.146
retrieving revision 2.147
diff -C2 -d -r2.146 -r2.147
*** typeobject.c	24 May 2002 21:38:46 -0000	2.146
--- typeobject.c	3 Jun 2002 19:52:41 -0000	2.147
***************
*** 1223,1228 ****
  	mro = type->tp_mro;
  	if (mro == NULL) {
! 		if (PyType_Ready(type) < 0)
  			return NULL;
  		mro = type->tp_mro;
  		assert(mro != NULL);
--- 1223,1238 ----
  	mro = type->tp_mro;
  	if (mro == NULL) {
! 		if (PyType_Ready(type) < 0) {
! 			/* It's not ideal to clear the error condition,
! 			   but this function is documented as not setting
! 			   an exception, and I don't want to change that.
! 			   When PyType_Ready() can't proceed, it won't
! 			   set the "ready" flag, so future attempts to ready
! 			   the same type will call it again -- hopefully
! 			   in a context that propagates the exception out.
! 			*/
! 			PyErr_Clear();
  			return NULL;
+ 		}
  		mro = type->tp_mro;
  		assert(mro != NULL);