summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:03:48 +0000
committerFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:03:48 +0000
commitfad4c5b309c9c625f1c42e12df9377fbb00ef12f (patch)
treeeab6803fe37709d2b2cdb616be9f15a1f1428079
parent72c7cf9cf5bf9d874dc3d9774566a835fa0a5474 (diff)
downloadlasso-fad4c5b309c9c625f1c42e12df9377fbb00ef12f.tar.gz
lasso-fad4c5b309c9c625f1c42e12df9377fbb00ef12f.tar.xz
lasso-fad4c5b309c9c625f1c42e12df9377fbb00ef12f.zip
[project @ fpeters@0d.be-20071031161008-c5jqe7topkxoaoe0]
raise TypeError when assigning a Python list to a member expecting a tuple Original author: Frederic Peters <fpeters@0d.be> Date: 2007-10-31 17:10:08.047000+01:00
-rw-r--r--bindings/lang_python.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bindings/lang_python.py b/bindings/lang_python.py
index 16ee7996..de31fd09 100644
--- a/bindings/lang_python.py
+++ b/bindings/lang_python.py
@@ -459,8 +459,12 @@ register_constants(PyObject *d)
print >> fd, ' this->%s = g_strdup(value);' % m[1]
elif parse_format == 'O' and arg_type == 'GList*':
elem_type = m[2].get('elem_type')
- # XXX: raise appropriate exception (TypeError)
- print >> fd, ' if (!PyTuple_Check(cvt_value)) return NULL;'
+ print >> fd, '''\
+ if (!PyTuple_Check(cvt_value)) {
+ PyErr_SetString(PyExc_TypeError, "value should be tuple");
+ return NULL;
+ }
+'''
if elem_type == 'char*':
print >> fd, '''\
if (this->%(v)s) {