[Python-checkins] python/dist/src/Objects typeobject.c,2.159,2.160
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Tue, 16 Jul 2002 12:39:42 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv18141
Modified Files:
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.159
retrieving revision 2.160
diff -C2 -d -r2.159 -r2.160
*** typeobject.c 16 Jul 2002 14:30:28 -0000 2.159
--- typeobject.c 16 Jul 2002 19:39:38 -0000 2.160
***************
*** 200,204 ****
return obj;
type = obj->ob_type;
! if (type->tp_init != NULL &&
type->tp_init(obj, args, kwds) < 0) {
Py_DECREF(obj);
--- 200,205 ----
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);