[Python-checkins] python/dist/src/Objects typeobject.c,2.144,2.145
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 24 May 2002 11:47:50 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv20828
Modified Files:
typeobject.c
Log Message:
Add a safeguard against setting the class to something with a
different free or alloc slot.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.144
retrieving revision 2.145
diff -C2 -d -r2.144 -r2.145
*** typeobject.c 18 Apr 2002 04:12:28 -0000 2.144
--- typeobject.c 24 May 2002 18:47:47 -0000 2.145
***************
*** 1623,1626 ****
--- 1623,1636 ----
}
new = (PyTypeObject *)value;
+ if (new->tp_dealloc != old->tp_dealloc ||
+ new->tp_free != old->tp_free)
+ {
+ PyErr_Format(PyExc_TypeError,
+ "__class__ assignment: "
+ "'%s' deallocator differs from '%s'",
+ new->tp_name,
+ old->tp_name);
+ return -1;
+ }
newbase = new;
oldbase = old;