[pygi] Revert "Use the limit constants from glib and interpret G_MAXUINT32 as PyLong_FromLongLong"
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pygi] Revert "Use the limit constants from glib and interpret G_MAXUINT32 as PyLong_FromLongLong"
- Date: Mon, 30 Nov 2009 10:54:37 +0000 (UTC)
commit e7e2fccae36c28c7e9f288fcd4c90a001140e307
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Mon Nov 30 10:53:57 2009 +0000
Revert "Use the limit constants from glib and interpret G_MAXUINT32 as PyLong_FromLongLong"
This reverts commit 05a2ed55f3e5d2620de8b3b6b0d99e928ef3b041.
gi/pygi-argument.c | 14 +++++++-------
tests/test_gi.py | 18 +++++++++---------
2 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index feae974..8411b62 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -52,21 +52,21 @@ _pygi_g_type_tag_py_bounds (GITypeTag type_tag,
*lower = PyInt_FromLong(0);
break;
case GI_TYPE_TAG_INT32:
- *lower = PyInt_FromLong(G_MININT32);
- *upper = PyInt_FromLong(G_MAXINT32);
+ *lower = PyInt_FromLong(-2147483648);
+ *upper = PyInt_FromLong(2147483647);
break;
case GI_TYPE_TAG_UINT32:
/* Note: On 32-bit archs, this number doesn't fit in a long. */
- *upper = PyLong_FromLongLong(G_MAXUINT32);
+ *upper = PyLong_FromLongLong(4294967295);
*lower = PyInt_FromLong(0);
break;
case GI_TYPE_TAG_INT64:
/* Note: On 32-bit archs, these numbers don't fit in a long. */
- *lower = PyLong_FromLongLong(G_MININT64);
- *upper = PyLong_FromLongLong(G_MAXINT64);
+ *lower = PyLong_FromLongLong(-9223372036854775808u);
+ *upper = PyLong_FromLongLong(9223372036854775807);
break;
case GI_TYPE_TAG_UINT64:
- *upper = PyLong_FromUnsignedLongLong(G_MAXUINT64);
+ *upper = PyLong_FromUnsignedLongLong(18446744073709551615u);
*lower = PyInt_FromLong(0);
break;
case GI_TYPE_TAG_SHORT:
@@ -1342,7 +1342,7 @@ _pygi_argument_to_object (GArgument *arg,
{
guint32 value;
value = is_pointer ? *(guint32 *)arg->v_pointer : arg->v_uint32;
- object = PyLong_FromLongLong(value);
+ object = PyInt_FromLong(value);
break;
}
case GI_TYPE_TAG_INT64:
diff --git a/tests/test_gi.py b/tests/test_gi.py
index bfbeeed..4503d62 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -83,8 +83,8 @@ class TestBoolean(unittest.TestCase):
class TestInt8(unittest.TestCase):
- MAX = gobject.G_MAXINT8
- MIN = gobject.G_MININT8
+ MAX = 2 ** 7 - 1
+ MIN = - (2 ** 7)
def test_int8_return(self):
self.assertEquals(self.MAX, TestGI.int8_return_max())
@@ -125,7 +125,7 @@ class TestInt8(unittest.TestCase):
class TestUInt8(unittest.TestCase):
- MAX = gobject.G_MAXUINT8
+ MAX = 2 ** 8 - 1
def test_uint8_return(self):
self.assertEquals(self.MAX, TestGI.uint8_return())
@@ -155,8 +155,8 @@ class TestUInt8(unittest.TestCase):
class TestInt16(unittest.TestCase):
- MAX = gobject.G_MAXINT16
- MIN = gobject.G_MININT16
+ MAX = 2 ** 15 - 1
+ MIN = - (2 ** 15)
def test_int16_return(self):
self.assertEquals(self.MAX, TestGI.int16_return_max())
@@ -197,7 +197,7 @@ class TestInt16(unittest.TestCase):
class TestUInt16(unittest.TestCase):
- MAX = gobject.G_MAXUINT16
+ MAX = 2 ** 16 - 1
def test_uint16_return(self):
self.assertEquals(self.MAX, TestGI.uint16_return())
@@ -226,8 +226,8 @@ class TestUInt16(unittest.TestCase):
class TestInt32(unittest.TestCase):
- MAX = gobject.G_MAXINT32
- MIN = gobject.G_MININT32
+ MAX = 2 ** 31 - 1
+ MIN = - (2 ** 31)
def test_int32_return(self):
self.assertEquals(self.MAX, TestGI.int32_return_max())
@@ -268,7 +268,7 @@ class TestInt32(unittest.TestCase):
class TestUInt32(unittest.TestCase):
- MAX = gobject.G_MAXUINT32
+ MAX = 2 ** 32 - 1
def test_uint32_return(self):
self.assertEquals(self.MAX, TestGI.uint32_return())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]