[pygobject] Unify unichar to Python GI marshaling code
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Unify unichar to Python GI marshaling code
- Date: Fri, 5 Apr 2013 12:54:19 +0000 (UTC)
commit 03ff41ae4bb83858338d96cc6210092c7fb82464
Author: Simon Feltman <sfeltman src gnome org>
Date: Thu Mar 28 05:10:45 2013 -0700
Unify unichar to Python GI marshaling code
Change _pygi_argument_to_object to use the cachers marshaler
(_pygi_marshal_to_py_unichar) directly instead of keeping a
copy of the code.
https://bugzilla.gnome.org/show_bug.cgi?id=693405
gi/pygi-argument.c | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index a122b32..44dff1a 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -1522,23 +1522,8 @@ _pygi_argument_to_object (GIArgument *arg,
}
case GI_TYPE_TAG_UNICHAR:
{
- /* Preserve the bidirectional mapping between 0 and "" */
- if (arg->v_uint32 == 0) {
- object = PYGLIB_PyUnicode_FromString ("");
- } else if (g_unichar_validate (arg->v_uint32)) {
- gchar utf8[6];
- gint bytes;
-
- bytes = g_unichar_to_utf8 (arg->v_uint32, utf8);
- object = PYGLIB_PyUnicode_FromStringAndSize ((char*)utf8, bytes);
- } else {
- /* TODO: Convert the error to an exception. */
- PyErr_Format (PyExc_TypeError,
- "Invalid unicode codepoint %" G_GUINT32_FORMAT,
- arg->v_uint32);
- object = Py_None;
- Py_INCREF (object);
- }
+ object = _pygi_marshal_to_py_unichar (NULL, NULL, NULL,
+ arg);
break;
}
case GI_TYPE_TAG_UTF8:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]