[pygobject/pygobject-2-28] fix a typo when converting objects to strings gvalues
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-2-28] fix a typo when converting objects to strings gvalues
- Date: Wed, 23 Mar 2011 16:06:51 +0000 (UTC)
commit 075ead0533ba311120b3ca9ac9ae75ca84ace8fb
Author: John (J5) Palmieri <johnp redhat com>
Date: Wed Mar 23 10:39:19 2011 -0400
fix a typo when converting objects to strings gvalues
gobject/pygtype.c | 4 ++--
tests/test_properties.py | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index f317b3b..5ee54aa 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -904,9 +904,9 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj)
}
} else {
#if PY_VERSION_HEX < 0x03000000
- g_value_set_string(value, PyString_AsString(obj));
+ g_value_set_string(value, PyString_AsString(tmp_str));
#else
- tmp = PyUnicode_AsUTF8String(obj);
+ tmp = PyUnicode_AsUTF8String(tmp_str);
g_value_set_string(value, PyBytes_AsString(tmp));
Py_DECREF(tmp);
#endif
diff --git a/tests/test_properties.py b/tests/test_properties.py
index 1499903..54afd11 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -88,6 +88,14 @@ class TestProperties(unittest.TestCase):
obj.props.normal = UNICODE_UTF8
self.assertEqual(obj.props.normal, TEST_UTF8)
+ def testIntToStr(self):
+ obj = new(PropertyObject, construct_only=1)
+ self.assertEqual(obj.props.construct_only, '1')
+ obj.set_property('construct', '2')
+ self.assertEqual(obj.props.construct, '2')
+ obj.props.normal = 3
+ self.assertEqual(obj.props.normal, '3')
+
def testConstructOnly(self):
obj = new(PropertyObject, construct_only="123")
self.assertEqual(obj.props.construct_only, "123")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]