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>
This commit is contained in:
parent
3d576e040a
commit
7a36f17982
|
@ -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;'
|
||||
|
|
Loading…
Reference in New Issue