diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-06-15 12:38:16 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-06-15 12:38:16 +0000 |
| commit | 28bf7912f0c4d94329b1ba5a22a80a7328174643 (patch) | |
| tree | acdc0519e04736a58b4290c16d45415bb22ef6cc /bindings/python | |
| parent | f5d0b4e34384ed20f1d2ed0456565b15fedb197c (diff) | |
| download | lasso-28bf7912f0c4d94329b1ba5a22a80a7328174643.tar.gz lasso-28bf7912f0c4d94329b1ba5a22a80a7328174643.tar.xz lasso-28bf7912f0c4d94329b1ba5a22a80a7328174643.zip | |
Python Binding: fix bug of uninitialized ppos argument to PyDict_Next
* bindings/pyhton/wrapper_top.c (set_hashtable_of_pygobject):
second argument (int*ppos) of PyDict_Next must be reinitialized to
zero before each traversal (see Python C API
http://docs.python.org/c-api/dict.html).
Patch from Iban RodrÃguez of the Desarrollo de Producto Electrónico,
Spain.
Diffstat (limited to 'bindings/python')
| -rw-r--r-- | bindings/python/wrapper_top.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bindings/python/wrapper_top.c b/bindings/python/wrapper_top.c index e71c5fa2..4de78737 100644 --- a/bindings/python/wrapper_top.c +++ b/bindings/python/wrapper_top.c @@ -141,14 +141,15 @@ set_hashtable_of_pygobject(GHashTable *a_hash, PyObject *dict) { if (! PyString_Check(key) || ! PyObject_TypeCheck(value, &PyGObjectPtrType)) { PyErr_SetString(PyExc_TypeError, - "value should be a dict," - "with string keys" + "value should be a dict, " + "with string keys " "and GObjectPtr values"); goto failure; } g_object_ref(((PyGObjectPtr*)value)->obj); } g_hash_table_remove_all (a_hash); + i = 0; while (PyDict_Next(dict, &i, &key, &value)) { char *ckey = g_strdup(PyString_AsString(key)); g_hash_table_replace (a_hash, ckey, ((PyGObjectPtr*)value)->obj); |
