[pygi] Allow creating structs with pointers
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] Allow creating structs with pointers
- Date: Fri, 16 Apr 2010 18:50:19 +0000 (UTC)
commit e73b6f6fe8b5f23a2a390ae0a6bbced593ded155
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Fri Apr 16 14:35:13 2010 -0400
Allow creating structs with pointers
https://bugzilla.gnome.org/show_bug.cgi?id=603537
gi/pygi-struct.c | 6 ------
tests/test_gi.py | 3 ++-
2 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c
index b1e81bf..f15a6cd 100644
--- a/gi/pygi-struct.c
+++ b/gi/pygi-struct.c
@@ -65,12 +65,6 @@ _struct_new (PyTypeObject *type,
return NULL;
}
- is_simple = pygi_g_struct_info_is_simple((GIStructInfo *)info);
- if (!is_simple) {
- PyErr_Format(PyExc_TypeError, "cannot create '%s' instances", type->tp_name);
- goto out;
- }
-
size = g_struct_info_get_size((GIStructInfo *)info);
pointer = g_try_malloc0(size);
if (pointer == NULL) {
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 89dfe87..9b9a849 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -998,7 +998,8 @@ class TestStructure(unittest.TestCase):
del struct
def test_not_simple_struct(self):
- self.assertRaises(TypeError, GIMarshallingTests.NotSimpleStruct)
+ struct = GIMarshallingTests.NotSimpleStruct()
+ self.assertEquals(None, struct.pointer)
def test_simple_struct_return(self):
struct = GIMarshallingTests.simple_struct_return()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]