summaryrefslogtreecommitdiff
path: root/gi/pygi-marshal-from-py.c
diff options
context:
space:
mode:
Diffstat (limited to 'gi/pygi-marshal-from-py.c')
-rw-r--r--gi/pygi-marshal-from-py.c156
1 files changed, 0 insertions, 156 deletions
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index 3867c233..acea4f34 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -495,162 +495,6 @@ array_success:
}
gboolean
-_pygi_marshal_from_py_glist (PyGIInvokeState *state,
- PyGICallableCache *callable_cache,
- PyGIArgCache *arg_cache,
- PyObject *py_arg,
- GIArgument *arg,
- gpointer *cleanup_data)
-{
- PyGIMarshalFromPyFunc from_py_marshaller;
- int i;
- Py_ssize_t length;
- GList *list_ = NULL;
- PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
-
-
- if (py_arg == Py_None) {
- arg->v_pointer = NULL;
- return TRUE;
- }
-
- if (!PySequence_Check (py_arg)) {
- PyErr_Format (PyExc_TypeError, "Must be sequence, not %s",
- py_arg->ob_type->tp_name);
- return FALSE;
- }
-
- length = PySequence_Length (py_arg);
- if (length < 0)
- return FALSE;
-
- from_py_marshaller = sequence_cache->item_cache->from_py_marshaller;
- for (i = 0; i < length; i++) {
- GIArgument item = {0};
- gpointer item_cleanup_data = NULL;
- PyObject *py_item = PySequence_GetItem (py_arg, i);
- if (py_item == NULL)
- goto err;
-
- if (!from_py_marshaller ( state,
- callable_cache,
- sequence_cache->item_cache,
- py_item,
- &item,
- &item_cleanup_data))
- goto err;
-
- Py_DECREF (py_item);
- list_ = g_list_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag));
- continue;
-err:
- /* FIXME: clean up list
- if (sequence_cache->item_cache->from_py_cleanup != NULL) {
- PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup;
- }
- */
- Py_DECREF (py_item);
- g_list_free (list_);
- _PyGI_ERROR_PREFIX ("Item %i: ", i);
- return FALSE;
- }
-
- arg->v_pointer = g_list_reverse (list_);
-
- if (arg_cache->transfer == GI_TRANSFER_NOTHING) {
- /* Free everything in cleanup. */
- *cleanup_data = arg->v_pointer;
- } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) {
- /* Make a shallow copy so we can free the elements later in cleanup
- * because it is possible invoke will free the list before our cleanup. */
- *cleanup_data = g_list_copy (arg->v_pointer);
- } else { /* GI_TRANSFER_EVERYTHING */
- /* No cleanup, everything is given to the callee. */
- *cleanup_data = NULL;
- }
- return TRUE;
-}
-
-gboolean
-_pygi_marshal_from_py_gslist (PyGIInvokeState *state,
- PyGICallableCache *callable_cache,
- PyGIArgCache *arg_cache,
- PyObject *py_arg,
- GIArgument *arg,
- gpointer *cleanup_data)
-{
- PyGIMarshalFromPyFunc from_py_marshaller;
- int i;
- Py_ssize_t length;
- GSList *list_ = NULL;
- PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
-
- if (py_arg == Py_None) {
- arg->v_pointer = NULL;
- return TRUE;
- }
-
- if (!PySequence_Check (py_arg)) {
- PyErr_Format (PyExc_TypeError, "Must be sequence, not %s",
- py_arg->ob_type->tp_name);
- return FALSE;
- }
-
- length = PySequence_Length (py_arg);
- if (length < 0)
- return FALSE;
-
- from_py_marshaller = sequence_cache->item_cache->from_py_marshaller;
- for (i = 0; i < length; i++) {
- GIArgument item = {0};
- gpointer item_cleanup_data = NULL;
- PyObject *py_item = PySequence_GetItem (py_arg, i);
- if (py_item == NULL)
- goto err;
-
- if (!from_py_marshaller ( state,
- callable_cache,
- sequence_cache->item_cache,
- py_item,
- &item,
- &item_cleanup_data))
- goto err;
-
- Py_DECREF (py_item);
- list_ = g_slist_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag));
- continue;
-err:
- /* FIXME: Clean up list
- if (sequence_cache->item_cache->from_py_cleanup != NULL) {
- PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup;
- }
- */
-
- Py_DECREF (py_item);
- g_slist_free (list_);
- _PyGI_ERROR_PREFIX ("Item %i: ", i);
- return FALSE;
- }
-
- arg->v_pointer = g_slist_reverse (list_);
-
- if (arg_cache->transfer == GI_TRANSFER_NOTHING) {
- /* Free everything in cleanup. */
- *cleanup_data = arg->v_pointer;
- } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) {
- /* Make a shallow copy so we can free the elements later in cleanup
- * because it is possible invoke will free the list before our cleanup. */
- *cleanup_data = g_slist_copy (arg->v_pointer);
- } else { /* GI_TRANSFER_EVERYTHING */
- /* No cleanup, everything is given to the callee. */
- *cleanup_data = NULL;
- }
-
- return TRUE;
-}
-
-
-gboolean
_pygi_marshal_from_py_gerror (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,