[pygobject] Revert "Revert "to python struct marshalling: copy boxed during cleanup""
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Revert "Revert "to python struct marshalling: copy boxed during cleanup""
- Date: Fri, 16 Feb 2018 19:19:30 +0000 (UTC)
commit e41dd91e9e62eeaeaa0fee97b50500591a87b249
Author: Mathieu Duponchelle <mathieu centricular com>
Date: Thu Feb 15 23:32:37 2018 +0100
Revert "Revert "to python struct marshalling: copy boxed during cleanup""
This reverts commit 10c062001ddd948b0a70545cbf613b38ed6fa46c.
gi/pygi-struct-marshal.c | 34 +++++++++++++++++++++++++++-------
tests/test_gi.py | 1 -
2 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c
index f1b9f13b..44797e75 100644
--- a/gi/pygi-struct-marshal.c
+++ b/gi/pygi-struct-marshal.c
@@ -439,14 +439,19 @@ arg_struct_to_py_marshal_adapter (PyGIInvokeState *state,
gpointer *cleanup_data)
{
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
+ PyObject *ret;
- return pygi_arg_struct_to_py_marshal (arg,
- iface_cache->interface_info,
- iface_cache->g_type,
- iface_cache->py_type,
- arg_cache->transfer,
- arg_cache->is_caller_allocates,
- iface_cache->is_foreign);
+ ret = pygi_arg_struct_to_py_marshal (arg,
+ iface_cache->interface_info,
+ iface_cache->g_type,
+ iface_cache->py_type,
+ arg_cache->transfer,
+ arg_cache->is_caller_allocates,
+ iface_cache->is_foreign);
+
+ *cleanup_data = ret;
+
+ return ret;
}
static void
@@ -463,6 +468,17 @@ arg_foreign_to_py_cleanup (PyGIInvokeState *state,
}
}
+static void
+arg_boxed_to_py_cleanup (PyGIInvokeState *state,
+ PyGIArgCache *arg_cache,
+ gpointer cleanup_data,
+ gpointer data,
+ gboolean was_processed)
+{
+ if (arg_cache->transfer == GI_TRANSFER_NOTHING)
+ _pygi_boxed_copy_in_place ((PyGIBoxed *) cleanup_data);
+}
+
static gboolean
arg_type_class_from_py_marshal (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
@@ -542,6 +558,10 @@ arg_struct_to_py_setup (PyGIArgCache *arg_cache,
if (iface_cache->is_foreign)
arg_cache->to_py_cleanup = arg_foreign_to_py_cleanup;
+ else if (!g_type_is_a (iface_cache->g_type, G_TYPE_VALUE) &&
+ iface_cache->py_type &&
+ g_type_is_a (iface_cache->g_type, G_TYPE_BOXED))
+ arg_cache->to_py_cleanup = arg_boxed_to_py_cleanup;
}
PyGIArgCache *
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 8d54004e..31085206 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -2562,7 +2562,6 @@ class TestPythonGObject(unittest.TestCase):
@unittest.skipUnless(hasattr(GIMarshallingTests, 'callback_owned_boxed'),
'requires newer version of GI')
- @unittest.expectedFailure # bug 722899
def test_callback_owned_box(self):
def callback(box, data):
self.box = box
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]