[Python-checkins] python/dist/src/Objects object.c,2.198,2.199
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Tue, 18 Feb 2003 19:19:32 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv30040
Modified Files:
object.c
Log Message:
PyObject_Generic{Get,Set}Attr:
Don't access tp_descr_{get,set} of a descriptor without checking the
flag bits of the descriptor's type. While we know that the main type
(the type of the object whose attribute is being accessed) has all the
right flag bits (or else PyObject_Generic{Get,Set}Attr wouldn't be
called), we don't know that for its class attributes!
Will backport to 2.2.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.198
retrieving revision 2.199
diff -C2 -d -r2.198 -r2.199
*** object.c 18 Feb 2003 16:40:09 -0000 2.198
--- object.c 19 Feb 2003 03:19:29 -0000 2.199
***************
*** 1363,1367 ****
f = NULL;
! if (descr != NULL) {
f = descr->ob_type->tp_descr_get;
if (f != NULL && PyDescr_IsData(descr)) {
--- 1363,1368 ----
f = NULL;
! if (descr != NULL &&
! PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) {
f = descr->ob_type->tp_descr_get;
if (f != NULL && PyDescr_IsData(descr)) {
***************
*** 1455,1459 ****
descr = _PyType_Lookup(tp, name);
f = NULL;
! if (descr != NULL) {
f = descr->ob_type->tp_descr_set;
if (f != NULL && PyDescr_IsData(descr)) {
--- 1456,1461 ----
descr = _PyType_Lookup(tp, name);
f = NULL;
! if (descr != NULL &&
! PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) {
f = descr->ob_type->tp_descr_set;
if (f != NULL && PyDescr_IsData(descr)) {