summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-04-17 22:10:31 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2014-04-23 13:40:27 (GMT)
commit7a36f17982142a5c219008e7932887e7c8b412b4 (patch)
treec7761218ff1dbd3b34856313b236d886394fc1f4 /bindings
parent3d576e040a6d0a1462b620972d223d4326f9246b (diff)
downloadlasso-7a36f17982142a5c219008e7932887e7c8b412b4.zip
lasso-7a36f17982142a5c219008e7932887e7c8b412b4.tar.gz
lasso-7a36f17982142a5c219008e7932887e7c8b412b4.tar.bz2
Fix generators for parsing of integer values
All number types including enums are parse as if they were integers, this breaks in many ways, long and int are not the same size in all architectures as well as enum may vary in size depening on compiler, architecture and optimizations. Always pass an actual long to PyArg_ParseTuple() and rely on the a cast from long to the destination variable type in the following assignment. Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/lang.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py
index f5c9d36..c695518 100644
--- a/bindings/python/lang.py
+++ b/bindings/python/lang.py
@@ -770,9 +770,9 @@ register_constants(PyObject *d)
parse_arg = '&value'
print >> fd, ' %s value;' % type
elif is_int(m, self.binding_data):
- parse_format = 'i'
+ parse_format = 'l'
parse_arg = '&value'
- print >> fd, ' %s value;' % type
+ print >> fd, ' long value;'
elif is_glist(m) or is_hashtable(m) or is_xml_node(m) or is_boolean(m):
parse_format = 'O'
print >> fd, ' PyObject *cvt_value;'