From c5ff65130e3c4353bfcdf1dcf3ab1d912597601d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 27 Jan 2014 20:27:26 +0100 Subject: python/generic.h: Fix MkPyNumber to work if char is unsigned. We currently consider two cases "unsigned char" and "char". This works as long as "char" is signed, but this is not guaranteed. Change "char" to "signed char" instead. --- python/generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') diff --git a/python/generic.h b/python/generic.h index 26736f1a..bcc4a5e4 100644 --- a/python/generic.h +++ b/python/generic.h @@ -250,7 +250,7 @@ inline PyObject *MkPyNumber(long long o) { return PyLong_FromLongLong(o); } inline PyObject *MkPyNumber(long o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(int o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(short o) { return PyInt_FromLong(o); } -inline PyObject *MkPyNumber(char o) { return PyInt_FromLong(o); } +inline PyObject *MkPyNumber(signed char o) { return PyInt_FromLong(o); } inline PyObject *MkPyNumber(double o) { return PyFloat_FromDouble(o); } -- cgit v1.2.3