summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--typewrappers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/typewrappers.c b/typewrappers.c
index 6d53247..1395728 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -132,18 +132,18 @@ int
libvirt_uintUnwrap(PyObject *obj,
unsigned int *val)
{
- long long_val;
+ unsigned long long_val;
if (!obj) {
PyErr_SetString(PyExc_TypeError, "unexpected type");
return -1;
}
- long_val = PyLong_AsLong(obj);
- if ((long_val == -1) && PyErr_Occurred())
+ long_val = PyLong_AsUnsignedLong(obj);
+ if ((long_val == (unsigned long)-1) && PyErr_Occurred())
return -1;
- if (long_val >= 0 && long_val <= UINT_MAX) {
+ if (long_val <= UINT_MAX) {
*val = long_val;
} else {
PyErr_SetString(PyExc_OverflowError,