[pygobject] handle uchar as bytes, not strings in python 3



commit 618dbb0ee15b47e5e7cb16a34ffce0937d7fa26d
Author: John (J5) Palmieri <johnp redhat com>
Date:   Fri Mar 4 12:25:49 2011 -0500

    handle uchar as bytes, not strings in python 3
    
    * This worked in Python2 because bytes and strings are equivilant and the macro
      PYGLIB_PyString_FromStringAndSize evaluated to a PyString
    * In Python 3 PYGLIB_PyString_FromStringAndSize evaluates to a PyUnicode
    * PYGLIB_PyBytes_FromStringAndSize evaluates to a PyString in Python 2
      and a PyBytes object in Python 3

 gobject/pygtype.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index 827ba7f..40d9b42 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -1021,7 +1021,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed)
     }
     case G_TYPE_UCHAR: {
 	guint8 val = g_value_get_uchar(value);
-	return PYGLIB_PyUnicode_FromStringAndSize((char *)&val, 1);
+	return PYGLIB_PyBytes_FromStringAndSize((char *)&val, 1);
     }
     case G_TYPE_BOOLEAN: {
 	return PyBool_FromLong(g_value_get_boolean(value));



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