[Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.19,2.126.4.20
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Tue, 16 Jul 2002 12:42:24 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv19225
Modified Files:
Tag: release22-maint
typeobject.c
Log Message:
The object returned by tp_new() may not have a tp_init.
If the object is an ExtensionClass, for example, the slot is not even
defined. So we must check that the type has the slot (implied by
HAVE_CLASS) before calling tp_init().
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.126.4.19
retrieving revision 2.126.4.20
diff -C2 -d -r2.126.4.19 -r2.126.4.20
*** typeobject.c 11 Jul 2002 07:06:44 -0000 2.126.4.19
--- typeobject.c 16 Jul 2002 19:42:21 -0000 2.126.4.20
***************
*** 191,195 ****
return obj;
type = obj->ob_type;
! if (type->tp_init != NULL &&
type->tp_init(obj, args, kwds) < 0) {
Py_DECREF(obj);
--- 191,196 ----
return obj;
type = obj->ob_type;
! if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS) &&
! type->tp_init != NULL &&
type->tp_init(obj, args, kwds) < 0) {
Py_DECREF(obj);