summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2007-05-20 10:50:10 -0700
committerBrian Harring <ferringb@gmail.com>2007-05-20 10:50:10 -0700
commitd5aa6ec8de965bb151c2ca85325f85d31643ae8a (patch)
tree6b03826b88536e0fc78b97ae8bf46664a9dc3251
parentsplit up snakeoil_IMMUTABLE_ATTR_BOOL a bit, so that a mutable version can re... (diff)
downloadsnakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.tar.gz
snakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.tar.bz2
snakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.zip
disallow deletion of the attr for mutable
-rw-r--r--include/snakeoil/common.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/snakeoil/common.h b/include/snakeoil/common.h
index 259d84d..8040b2f 100644
--- a/include/snakeoil/common.h
+++ b/include/snakeoil/common.h
@@ -29,7 +29,13 @@ snakeoil_ATTR_GET_BOOL(type, name, attr, get_test)
static int \
type##_set_##attr (type *self, PyObject *v, void *closure) \
{ \
- int tmp = PyObject_IsTrue(value); \
+ int tmp; \
+ if(!value) \
+ PyErr_SetString(PyExc_TypeError, \
+ "Cannot delete the "name" attribute") \
+ return -1; \
+ } \
+ = PyObject_IsTrue(value); \
if (tmp == -1) \
return -1; \
if(tmp) { \