[Python-checkins] python/dist/src/Objects descrobject.c,2.38,2.39

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Wed Apr 20 01:43:43 CEST 2005


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21640/Objects

Modified Files:
	descrobject.c 
Log Message:
As per discussion on python-dev, descriptors defined in C with a NULL setter
now raise AttributeError instead of TypeError, for consistency with their
pure-Python equivalent.



Index: descrobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v
retrieving revision 2.38
retrieving revision 2.39
diff -u -d -r2.38 -r2.39
--- descrobject.c	13 Dec 2003 11:58:56 -0000	2.38
+++ descrobject.c	19 Apr 2005 23:43:40 -0000	2.39
@@ -144,7 +144,7 @@
 		return res;
 	if (descr->d_getset->get != NULL)
 		return descr->d_getset->get(obj, descr->d_getset->closure);
-	PyErr_Format(PyExc_TypeError,
+	PyErr_Format(PyExc_AttributeError,
 		     "attribute '%.300s' of '%.100s' objects is not readable",
 		     descr_name((PyDescrObject *)descr),
 		     descr->d_type->tp_name);
@@ -199,7 +199,7 @@
 	if (descr->d_getset->set != NULL)
 		return descr->d_getset->set(obj, value,
 					    descr->d_getset->closure);
-	PyErr_Format(PyExc_TypeError,
+	PyErr_Format(PyExc_AttributeError,
 		     "attribute '%.300s' of '%.100s' objects is not writable",
 		     descr_name((PyDescrObject *)descr),
 		     descr->d_type->tp_name);



More information about the Python-checkins mailing list