[Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80.2.5,2.80.2.6

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 21 May 2001 21:00:19 -0700


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

Modified Files:
      Tag: descr-branch
	dictobject.c 
Log Message:
insertdict(): cope with the possibility that ma_lookup is NULL.  This
can happen when a derived type doesn't call dict_construct().


Index: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.80.2.5
retrieving revision 2.80.2.6
diff -C2 -r2.80.2.5 -r2.80.2.6
*** dictobject.c	2001/05/14 21:35:52	2.80.2.5
--- dictobject.c	2001/05/22 04:00:17	2.80.2.6
***************
*** 308,312 ****
  	PyObject *old_value;
  	register dictentry *ep;
! 	ep = (mp->ma_lookup)(mp, key, hash);
  	if (ep->me_value != NULL) {
  		old_value = ep->me_value;
--- 308,318 ----
  	PyObject *old_value;
  	register dictentry *ep;
! 	typedef PyDictEntry *(*lookupfunc)(PyDictObject *, PyObject *, long);
! 	register lookupfunc lookup;
! 
! 	lookup = mp->ma_lookup;
! 	if (lookup == NULL)
! 		mp->ma_lookup = lookup = lookdict_string;
! 	ep = lookup(mp, key, hash);
  	if (ep->me_value != NULL) {
  		old_value = ep->me_value;