*** Python-20011105/Include/descrobject.h Sun Oct 21 20:43:43 2001 --- dev1105/Include/descrobject.h Mon Nov 5 17:01:31 2001 *************** *** 77,80 **** --- 77,81 ---- extern DL_IMPORT(PyObject *) PyWrapper_New(PyObject *, PyObject *); + extern DL_IMPORT(PyTypeObject) PyMemberDescr_Type; extern DL_IMPORT(PyTypeObject) PyProperty_Type; *** Python-20011105/Objects/descrobject.c Sun Oct 21 20:43:43 2001 --- dev1105/Objects/descrobject.c Mon Nov 5 17:01:33 2001 *************** *** 373,379 **** 0, /* tp_descr_set */ }; ! static PyTypeObject PyMemberDescr_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "member_descriptor", --- 373,379 ---- 0, /* tp_descr_set */ }; ! PyTypeObject PyMemberDescr_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, "member_descriptor", *** Python-20011105/Objects/typeobject.c Mon Oct 29 17:25:44 2001 --- dev1105/Objects/typeobject.c Mon Nov 5 16:58:34 2001 *************** *** 894,899 **** --- 894,908 ---- Py_DECREF(slots); return NULL; } + else if ( PyDict_GetItem(dict, + PyTuple_GET_ITEM(slots, i))){ + PyErr_Format(PyExc_TypeError, + "type attribute name '%s' hides __slots__ " + "entry of same name", + PyString_AsString(PyTuple_GET_ITEM(slots, i))); + Py_DECREF(slots); + return NULL; + } /* XXX Check against null bytes in name */ } } *************** *** 1157,1162 **** --- 1166,1180 ---- PyExc_TypeError, "can't set attributes of built-in/extension type '%s'", type->tp_name); + return -1; + } + if ( PyObject_TypeCheck(_PyType_Lookup(type,name), + &PyMemberDescr_Type )){ + PyErr_Format( + PyExc_TypeError, + "type attribute name '%s' hides instance member of " + "same name", + PyString_AsString(name)); return -1; } if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0)