[pygobject] Fix unsigned values in GArray/GList/GSList/GHash
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix unsigned values in GArray/GList/GSList/GHash
- Date: Thu, 11 Oct 2012 14:08:49 +0000 (UTC)
commit 8a2e96cd4e33b6c119a368d73a9d5504576cdccb
Author: Martin Pitt <martinpitt gnome org>
Date: Thu Oct 11 16:08:11 2012 +0200
Fix unsigned values in GArray/GList/GSList/GHash
_pygi_hash_pointer_to_arg() needs to handle unsigned integers as well.
https://bugzilla.gnome.org/show_bug.cgi?id=685860
gi/pygi-argument.c | 9 +++++++++
tests/test_gi.py | 12 ++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index db79574..bffe9c4 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -83,6 +83,15 @@ _pygi_hash_pointer_to_arg (GIArgument *arg,
case GI_TYPE_TAG_INT32:
arg->v_int32 = GPOINTER_TO_INT (arg->v_pointer);
break;
+ case GI_TYPE_TAG_UINT8:
+ arg->v_uint8 = GPOINTER_TO_UINT (arg->v_pointer);
+ break;
+ case GI_TYPE_TAG_UINT16:
+ arg->v_uint16 = GPOINTER_TO_UINT (arg->v_pointer);
+ break;
+ case GI_TYPE_TAG_UINT32:
+ arg->v_uint32 = GPOINTER_TO_UINT (arg->v_pointer);
+ break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_INTERFACE:
diff --git a/tests/test_gi.py b/tests/test_gi.py
index ea58547..4301d03 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -819,6 +819,9 @@ class TestGArray(unittest.TestCase):
def test_garray_int_none_return(self):
self.assertEqual([-1, 0, 1, 2], GIMarshallingTests.garray_int_none_return())
+ def test_garray_uint64_none_return(self):
+ self.assertEqual([0, GObject.G_MAXUINT64], GIMarshallingTests.garray_uint64_none_return())
+
def test_garray_utf8_none_return(self):
self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_none_return())
@@ -836,6 +839,9 @@ class TestGArray(unittest.TestCase):
self.assertRaises(TypeError, GIMarshallingTests.garray_int_none_in, 42)
self.assertRaises(TypeError, GIMarshallingTests.garray_int_none_in, None)
+ def test_garray_uint64_none_in(self):
+ GIMarshallingTests.garray_uint64_none_in(Sequence([0, GObject.G_MAXUINT64]))
+
def test_garray_utf8_none_in(self):
GIMarshallingTests.garray_utf8_none_in(Sequence(['0', '1', '2']))
@@ -896,6 +902,9 @@ class TestGList(unittest.TestCase):
def test_glist_int_none_return(self):
self.assertEqual([-1, 0, 1, 2], GIMarshallingTests.glist_int_none_return())
+ def test_glist_uint32_none_return(self):
+ self.assertEqual([0, GObject.G_MAXUINT32], GIMarshallingTests.glist_uint32_none_return())
+
def test_glist_utf8_none_return(self):
self.assertEqual(['0', '1', '2'], GIMarshallingTests.glist_utf8_none_return())
@@ -913,6 +922,9 @@ class TestGList(unittest.TestCase):
self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, 42)
self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, None)
+ def test_glist_uint32_none_in(self):
+ GIMarshallingTests.glist_uint32_none_in(Sequence((0, GObject.G_MAXUINT32)))
+
def test_glist_utf8_none_in(self):
GIMarshallingTests.glist_utf8_none_in(Sequence(('0', '1', '2')))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]