[pygobject/pygi-py3k: 3/5] make sure we correctly chose between string and unicode



commit 01c2c860ed291d1e0193715a329d9fb19f140c18
Author: John (J5) Palmieri <johnp redhat com>
Date:   Thu Apr 15 15:28:29 2010 -0400

    make sure we correctly chose between string and unicode

 gi/pygi-info.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index 7acedd7..6f89e51 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -134,13 +134,25 @@ PyTypeObject PyGIBaseInfo_Type = {
 static PyObject *
 _wrap_g_base_info_get_name (PyGIBaseInfo *self)
 {
-    return PyUnicode_FromString(g_base_info_get_name(self->info));
+    return 
+#if PY_MAJOR_VERSION >= 3
+        PyUnicode_FromString
+#else 
+        PyString_FromString
+#endif
+        (g_base_info_get_name(self->info));
 }
 
 static PyObject *
 _wrap_g_base_info_get_namespace (PyGIBaseInfo *self)
 {
-    return PyUnicode_FromString(g_base_info_get_namespace(self->info));
+    return 
+#if PY_MAJOR_VERSION >= 3
+        PyUnicode_FromString
+#else 
+        PyString_FromString
+#endif
+        (g_base_info_get_namespace(self->info));
 }
 
 static PyObject *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]