From 906c0a229550a957e8f1b9d2cfaeaafe6c96f0a0 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 10 Dec 2013 17:57:54 -0500 Subject: [PATCH] lib/gen_pyobject.py: fix size checks Signed-off-by: Paul Brossier --- python/lib/gen_pyobject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lib/gen_pyobject.py b/python/lib/gen_pyobject.py index d3f72618..ba8274e5 100644 --- a/python/lib/gen_pyobject.py +++ b/python/lib/gen_pyobject.py @@ -239,9 +239,9 @@ Py_%(name)s_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) s += """\ self->%(pname)s = %(defval)s; - if (%(pname)s > 0) { + if ((sint_t)%(pname)s > 0) { self->%(pname)s = %(pname)s; - } else if (%(pname)s < 0) { + } else if ((sint_t)%(pname)s < 0) { PyErr_SetString (PyExc_ValueError, "can not use negative value for %(pname)s"); return NULL; -- 2.11.0