[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.120,2.121
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 04 Dec 2001 09:13:24 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv31518
Modified Files:
typeobject.c
Log Message:
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
There's now a new structmember code, T_OBJECT_EX, which is used for
all __slot__ variables (except __weakref__, which has special behavior
anyway). This new code raises AttributeError when the variable is
NULL rather than converting NULL to None.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.120
retrieving revision 2.121
diff -C2 -d -r2.120 -r2.121
*** typeobject.c 2001/12/03 15:36:28 2.120
--- typeobject.c 2001/12/04 17:13:22 2.121
***************
*** 1060,1068 ****
mp->name = PyString_AS_STRING(
PyTuple_GET_ITEM(slots, i));
! mp->type = T_OBJECT;
mp->offset = slotoffset;
if (base->tp_weaklistoffset == 0 &&
! strcmp(mp->name, "__weakref__") == 0)
type->tp_weaklistoffset = slotoffset;
slotoffset += sizeof(PyObject *);
}
--- 1060,1070 ----
mp->name = PyString_AS_STRING(
PyTuple_GET_ITEM(slots, i));
! mp->type = T_OBJECT_EX;
mp->offset = slotoffset;
if (base->tp_weaklistoffset == 0 &&
! strcmp(mp->name, "__weakref__") == 0) {
! mp->type = T_OBJECT;
type->tp_weaklistoffset = slotoffset;
+ }
slotoffset += sizeof(PyObject *);
}