[pygobject] only support C pointer arrays for structs and objects
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] only support C pointer arrays for structs and objects
- Date: Sat, 13 Aug 2011 12:47:52 +0000 (UTC)
commit c9d9ffd0380878792cbdb13dec4e53be897e5fbc
Author: John (J5) Palmieri <johnp redhat com>
Date: Sat Aug 13 08:46:18 2011 -0400
only support C pointer arrays for structs and objects
* There is no way to know if an array of structs or objects are pointer arrays
or flat arrays. Since pointer arrays are the most useful and prevelant
it has been decided to only support those arrays
gi/pygi-marshal-out.c | 2 +-
tests/test_gi.py | 8 --------
2 files changed, 1 insertions(+), 9 deletions(-)
---
diff --git a/gi/pygi-marshal-out.c b/gi/pygi-marshal-out.c
index f99ee25..8adf9ae 100644
--- a/gi/pygi-marshal-out.c
+++ b/gi/pygi-marshal-out.c
@@ -331,7 +331,7 @@ _pygi_marshal_out_array (PyGIInvokeState *state,
if (seq_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) {
item_arg.v_pointer = g_ptr_array_index ( ( GPtrArray *)array_, i);
} else if (item_arg_cache->type_tag == GI_TYPE_TAG_INTERFACE) {
- item_arg.v_pointer = array_->data + i * item_size;
+ item_arg.v_pointer = g_array_index (array_, gpointer, i);
if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *) item_arg_cache;
switch (g_base_info_get_type (iface_cache->interface_info)) {
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 45c1148..2e7f2dd 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -703,14 +703,6 @@ class TestArray(unittest.TestCase):
object_ = GIMarshallingTests.Object()
self.assertEquals([-1, 0, 1, 2], object_.method_array_return())
- def test_array_fixed_out_struct(self):
- struct1, struct2 = GIMarshallingTests.array_fixed_out_struct()
-
- self.assertEquals(7, struct1.long_)
- self.assertEquals(6, struct1.int8)
- self.assertEquals(6, struct2.long_)
- self.assertEquals(7, struct2.int8)
-
def test_array_zero_terminated_return(self):
self.assertEquals(['0', '1', '2'], GIMarshallingTests.array_zero_terminated_return())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]