Core and builtins
-----------------
+- Descriptors defined in C with a PyGetSetDef structure, where the setter is
+ NULL, now raise an AttributeError when attempting to set or delete the
+ attribute. Previously a TypeError was raised, but this was inconsistent
+ with the equivalent pure-Python implementation.
+
- It is now safe to call PyGILState_Release() before
PyEval_InitThreads() (note that if there is reason to believe there
are multiple threads around you still must call PyEval_InitThreads()
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);
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);