From ec14009beee0c742cf92ee05456af0fa759d7052 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 9 Sep 2007 21:53:06 +0000 Subject: [PATCH] handle Int and Long types --- bindings/python/_sigar.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bindings/python/_sigar.c b/bindings/python/_sigar.c index 96e468be..8078cfde 100644 --- a/bindings/python/_sigar.c +++ b/bindings/python/_sigar.c @@ -104,7 +104,15 @@ static int pysigar_parse_uint64(PyObject *args, sigar_uint64_t *val) return !SIGAR_OK; } - *val = PyInt_AsUnsignedLongLongMask(obj); + if (PyInt_Check(obj)) { + *val = PyInt_AsUnsignedLongLongMask(obj); + } + else if (PyLong_Check(obj)) { + *val = PyLong_AsUnsignedLongLong(obj); + } + else { + return !SIGAR_OK; + } return SIGAR_OK; }