diff options
author | Brian Harring <ferringb@gmail.com> | 2007-05-20 10:50:10 -0700 |
---|---|---|
committer | Brian Harring <ferringb@gmail.com> | 2007-05-20 10:50:10 -0700 |
commit | d5aa6ec8de965bb151c2ca85325f85d31643ae8a (patch) | |
tree | 6b03826b88536e0fc78b97ae8bf46664a9dc3251 | |
parent | split up snakeoil_IMMUTABLE_ATTR_BOOL a bit, so that a mutable version can re... (diff) | |
download | snakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.tar.gz snakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.tar.bz2 snakeoil-d5aa6ec8de965bb151c2ca85325f85d31643ae8a.zip |
disallow deletion of the attr for mutable
-rw-r--r-- | include/snakeoil/common.h | 8 |
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) { \ |