diff options
author | James Henstridge <james@daa.com.au> | 2003-12-23 14:20:21 +0000 |
---|---|---|
committer | James Henstridge <jamesh@src.gnome.org> | 2003-12-23 14:20:21 +0000 |
commit | aea18495810da51a0b7648bd44d0fe404211204b (patch) | |
tree | da91d9448da490bba87e54ae70f2ab81705f7446 | |
parent | e5687c0dc54011a83a97d9ec4c3676e5046b5c81 (diff) | |
download | pygobject-aea18495810da51a0b7648bd44d0fe404211204b.tar.gz |
explicitly check if the property is readable first, and raise an exception
2003-12-23 James Henstridge <james@daa.com.au>
* pygobject.c (pygobject_get_property): explicitly check if the
property is readable first, and raise an exception otherwise
(pygobject_set_property): check if property is readable (fixes bug
#121544).
-rw-r--r-- | gobject/pygobject.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 76e94cba..782f362d 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -521,6 +521,11 @@ pygobject_get_property(PyGObject *self, PyObject *args) "the object does not support the given parameter"); return NULL; } + if (!(pspec->flags & G_PARAM_READABLE)) { + PyErr_Format(PyExc_TypeError, "property %s is not readable", + param_name); + return NULL; + } g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); g_object_get_property(self->obj, param_name, &value); ret = pyg_value_as_pyobject(&value, TRUE); @@ -546,6 +551,11 @@ pygobject_set_property(PyGObject *self, PyObject *args) "the object does not support the given parameter"); return NULL; } + if (!(pspec->flags & G_PARAM_WRITABLE)) { + PyErr_Format(PyExc_TypeError, "property %s is not writable", + param_name); + return NULL; + } g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); if (pyg_value_from_pyobject(&value, pvalue) < 0) { PyErr_SetString(PyExc_TypeError, |