summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2005-04-19 23:43:40 (GMT)
committerBarry Warsaw <barry@python.org>2005-04-19 23:43:40 (GMT)
commitc8d907c60bacc4b08c03a71a6b714765df9e879d (patch)
tree991f0d997cf1d765d02e87a28052fa0a2966d9e9 /Objects
parenta267563f439763bc955daafaa0563b3194945fc3 (diff)
downloadcpython-c8d907c60bacc4b08c03a71a6b714765df9e879d.zip
cpython-c8d907c60bacc4b08c03a71a6b714765df9e879d.tar.gz
cpython-c8d907c60bacc4b08c03a71a6b714765df9e879d.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/descrobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 7d523cf..4aa1313 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -144,7 +144,7 @@ getset_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type)
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 @@ getset_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
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);