[Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.8,2.124.4.9
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 10 May 2001 08:21:30 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv14511
Modified Files:
Tag: descr-branch
object.c
Log Message:
In PyGeneric_SetAttr(), distinguish between non-existent and read-only
attributes when raising AttributeError.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.124.4.8
retrieving revision 2.124.4.9
diff -C2 -r2.124.4.8 -r2.124.4.9
*** object.c 2001/05/06 02:31:13 2.124.4.8
--- object.c 2001/05/10 15:21:28 2.124.4.9
***************
*** 1113,1120 ****
}
descr = PyDict_GetItem(tp->tp_dict, name);
! if (descr != NULL && (f = descr->ob_type->tp_descr_set) != NULL)
return (*f)(descr, obj, value);
PyErr_Format(PyExc_AttributeError,
! "'%.50s' object has no attribute '%.400s'",
tp->tp_name, PyString_AS_STRING(name));
return -1;
--- 1113,1126 ----
}
descr = PyDict_GetItem(tp->tp_dict, name);
! if (descr == NULL) {
! PyErr_Format(PyExc_AttributeError,
! "'%.50s' object has no attribute '%.400s'",
! tp->tp_name, PyString_AS_STRING(name));
! return -1;
! }
! if ((f = descr->ob_type->tp_descr_set) != NULL)
return (*f)(descr, obj, value);
PyErr_Format(PyExc_AttributeError,
! "'%.50s' object attribute '%.400s' is read-only",
tp->tp_name, PyString_AS_STRING(name));
return -1;