Commit 2eb2a712 authored by Simon Feltman's avatar Simon Feltman
Browse files

Unify filename to Python GI marshaling code

Change _pygi_argument_to_object to use the cachers marshaler
(_pygi_marshal_to_py_filename) directly instead of keeping a
copy of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=693405
parent 54aa043d
......@@ -1534,26 +1534,8 @@ _pygi_argument_to_object (GIArgument *arg,
}
case GI_TYPE_TAG_FILENAME:
{
GError *error = NULL;
gchar *string;
if (arg->v_string == NULL) {
object = Py_None;
Py_INCREF (object);
break;
}
string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
if (string == NULL) {
PyErr_SetString (PyExc_Exception, error->message);
/* TODO: Convert the error to an exception. */
break;
}
object = PYGLIB_PyUnicode_FromString (string);
g_free (string);
object = _pygi_marshal_to_py_filename (NULL, NULL, NULL,
arg);
break;
}
case GI_TYPE_TAG_ARRAY:
......
......@@ -306,14 +306,12 @@ _pygi_marshal_to_py_filename (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
GIArgument *arg)
{
gchar *string;
gchar *string = NULL;
PyObject *py_obj = NULL;
GError *error = NULL;
if (arg->v_string == NULL) {
py_obj = Py_None;
Py_INCREF (py_obj);
return py_obj;
Py_RETURN_NONE;
}
string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment