[pygobject] Unify filename to Python GI marshaling code
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Unify filename to Python GI marshaling code
- Date: Fri, 5 Apr 2013 12:54:29 +0000 (UTC)
commit 2eb2a712864a1a685d19018e0860cf0da7c5c9ab
Author: Simon Feltman <sfeltman src gnome org>
Date: Thu Mar 28 05:29:08 2013 -0700
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
gi/pygi-argument.c | 22 ++--------------------
gi/pygi-marshal-to-py.c | 6 ++----
2 files changed, 4 insertions(+), 24 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index dd0944f..8868d4e 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -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:
diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c
index fbd2bb0..31a6add 100644
--- a/gi/pygi-marshal-to-py.c
+++ b/gi/pygi-marshal-to-py.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]