[pygobject] _pygi_marshal_from_py_uint64: Re-fix check of negative values
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] _pygi_marshal_from_py_uint64: Re-fix check of negative values
- Date: Fri, 12 Oct 2012 09:06:19 +0000 (UTC)
commit a2ab72aa39824579d1767d1fdba7e1031341f86c
Author: Martin Pitt <martinpitt gnome org>
Date: Fri Oct 12 11:05:24 2012 +0200
_pygi_marshal_from_py_uint64: Re-fix check of negative values
Fix regression from commit 1bfcd5d94 (exposed by several test cases) when using
Python 2.x.
https://bugzilla.gnome.org/show_bug.cgi?id=685000
gi/pygi-marshal-from-py.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index 05a9b0c..b4c9fa0 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -565,13 +565,13 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check (py_long)) {
- guint64 long_ = (guint64) PyInt_AsLong (py_long);
- if (long_ > G_MAXUINT64) {
+ long long_ = PyInt_AsLong (py_long);
+ if (long_ < 0 || long_ > G_MAXUINT64) {
PyErr_Format (PyExc_ValueError, "%" G_GUINT64_FORMAT " not in range %d to %" G_GUINT64_FORMAT,
(gint64) long_, 0, G_MAXUINT64);
return FALSE;
}
- ulong_ = long_;
+ ulong_ = (guint64) long_;
} else
#endif
ulong_ = PyLong_AsUnsignedLongLong (py_long);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]