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

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


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

Modified Files:
      Tag: release22-maint
	typeobject.c 
Log Message:
Backport to 2.2.x:

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.


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.11
retrieving revision 2.126.4.12
diff -C2 -d -r2.126.4.11 -r2.126.4.12
*** typeobject.c	24 May 2002 21:41:26 -0000	2.126.4.11
--- typeobject.c	3 Jun 2002 19:54:10 -0000	2.126.4.12
***************
*** 1220,1225 ****
  	mro = type->tp_mro;
  	if (mro == NULL) {
! 		if (PyType_Ready(type) < 0)
  			return NULL;
  		mro = type->tp_mro;
  		assert(mro != NULL);
--- 1220,1235 ----
  	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);