diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:03:48 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:03:48 +0000 |
| commit | fad4c5b309c9c625f1c42e12df9377fbb00ef12f (patch) | |
| tree | eab6803fe37709d2b2cdb616be9f15a1f1428079 | |
| parent | 72c7cf9cf5bf9d874dc3d9774566a835fa0a5474 (diff) | |
| download | lasso-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.py | 8 |
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) { |
