[pygobject] Unify Python unicode to filename GI marshaling code
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Unify Python unicode to filename GI marshaling code
- Date: Fri, 5 Apr 2013 12:54:13 +0000 (UTC)
commit 594ad084c2cc21cebce209c11740e6d4866b0b82
Author: Simon Feltman <sfeltman src gnome org>
Date: Sat Feb 16 19:49:59 2013 -0800
Unify Python unicode to filename GI marshaling code
Change _pygi_argument_from_object to use the cachers marshaler
(_pygi_marshal_from_py_filename) directly instead of keeping a
copy of the code.
https://bugzilla.gnome.org/show_bug.cgi?id=693405
gi/pygi-argument.c | 30 ++----------------------------
1 files changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index cb3ac32..a122b32 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -1047,34 +1047,8 @@ _pygi_argument_from_object (PyObject *object,
}
case GI_TYPE_TAG_FILENAME:
{
- GError *error = NULL;
- gchar *string;
-
-#if PY_VERSION_HEX < 0x03000000
- string = g_strdup(PyString_AsString (object));
-#else
- {
- PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
- if (!pybytes_obj)
- break;
-
- string = g_strdup(PyBytes_AsString (pybytes_obj));
- Py_DECREF (pybytes_obj);
- }
-#endif
-
- if (string == NULL) {
- break;
- }
-
- arg.v_string = g_filename_from_utf8 (string, -1, NULL, NULL, &error);
- g_free(string);
-
- if (arg.v_string == NULL) {
- PyErr_SetString (PyExc_Exception, error->message);
- /* TODO: Convert the error to an exception. */
- }
-
+ _pygi_marshal_from_py_filename (NULL, NULL, NULL,
+ object, &arg);
break;
}
case GI_TYPE_TAG_ARRAY:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]