[Python-checkins] python/dist/src/Objects dictobject.c,2.134,2.135

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
2002年12月07日 00:10:53 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv19914/Objects
Modified Files:
	dictobject.c 
Log Message:
Remove assumption that cls is a subclass of dict.
Simplifies the code and gets Just van Rossum's example to work.
Index: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.134
retrieving revision 2.135
diff -C2 -d -r2.134 -r2.135
*** dictobject.c	4 Dec 2002 07:32:25 -0000	2.134
--- dictobject.c	7 Dec 2002 08:10:51 -0000	2.135
***************
*** 980,989 ****
 	if (d == NULL)
 		return NULL;
- 	if (!PyDict_Check(d)) {
- 		Py_DECREF(d);
- 		PyErr_SetString(PyExc_TypeError,
- 			"class constructor must return a subclass of dict");
- 		return NULL;
- 	}
 
 	it = PyObject_GetIter(seq);
--- 980,983 ----
***************
*** 1000,1004 ****
 			break;
 		}
! 		status = PyDict_SetItem(d, key, value);
 		Py_DECREF(key);
 		if (status < 0)
--- 994,998 ----
 			break;
 		}
! 		status = PyObject_SetItem(d, key, value);
 		Py_DECREF(key);
 		if (status < 0)

AltStyle によって変換されたページ (->オリジナル) /