[Python-checkins] python/dist/src/Objects sliceobject.c, 2.21, 2.21.16.1

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Sep 5 08:39:05 EDT 2003


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv15068/Objects
Modified Files:
 Tag: release23-maint
	sliceobject.c 
Log Message:
SF bug #800796: Difference between hash() and __hash__()
slice(5).__hash__() now raises a TypeError.
Index: sliceobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v
retrieving revision 2.21
retrieving revision 2.21.16.1
diff -C2 -d -r2.21 -r2.21.16.1
*** sliceobject.c	29 Dec 2002 16:33:11 -0000	2.21
--- sliceobject.c	5 Sep 2003 14:38:26 -0000	2.21.16.1
***************
*** 279,282 ****
--- 279,289 ----
 }
 
+ static long
+ slice_hash(PySliceObject *v)
+ {
+ 	PyErr_SetString(PyExc_TypeError, "unhashable type");
+ 	return -1L;
+ }
+ 
 PyTypeObject PySlice_Type = {
 	PyObject_HEAD_INIT(&PyType_Type)
***************
*** 294,298 ****
 	0,	 				/* tp_as_sequence */
 	0,					/* tp_as_mapping */
! 	0,					/* tp_hash */
 	0,					/* tp_call */
 	0,					/* tp_str */
--- 301,305 ----
 	0,	 				/* tp_as_sequence */
 	0,					/* tp_as_mapping */
! 	(hashfunc)slice_hash,			/* tp_hash */
 	0,					/* tp_call */
 	0,					/* tp_str */


More information about the Python-checkins mailing list

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