[pygobject] _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check
- Date: Thu, 4 Oct 2012 21:14:47 +0000 (UTC)
commit 1bfcd5d94b71edc9f03c8b3e87952a8bc8097586
Author: Alban Browaeys <prahal yahoo com>
Date: Thu Sep 27 22:44:22 2012 +0200
_pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check
Casting an unsigned to signed and checking if positive was not good. Check the
unsigned 64 is below G_MAXUINT64 instead.
Side issue in https://bugzilla.gnome.org/show_bug.cgi?id=685000
gi/pygi-marshal-from-py.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index d3e61da..45a9892 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -565,8 +565,8 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check (py_long)) {
- gint64 long_ = (gint64) PyInt_AsLong (py_long);
- if (long_ < 0) {
+ guint64 long_ = (guint64) PyInt_AsLong (py_long);
+ if (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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]