[pygobject/pygobject-3-30] GValue: fall back to the custom C marshaller to support fundamental types. See #280
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-30] GValue: fall back to the custom C marshaller to support fundamental types. See #280
- Date: Mon, 26 Nov 2018 21:40:09 +0000 (UTC)
commit 383f36b9ce5612761d319e45fd695e4aafeb1dad
Author: Christoph Reiter <reiter christoph gmail com>
Date: Mon Nov 26 22:29:01 2018 +0100
GValue: fall back to the custom C marshaller to support fundamental types. See #280
Backport from master
gi/overrides/GObject.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gi/overrides/GObject.py b/gi/overrides/GObject.py
index 68ba6d50..e2657299 100644
--- a/gi/overrides/GObject.py
+++ b/gi/overrides/GObject.py
@@ -297,7 +297,9 @@ class Value(GObjectModule.Value):
elif gtype == TYPE_PYOBJECT:
self.set_boxed(py_value)
else:
- raise TypeError("Unknown value type %s" % gtype)
+ # Fall back to _gvalue_set which handles some more cases
+ # like fundamentals for which a converter is registered
+ _gi._gvalue_set(self, py_value)
def get_value(self):
gtype = self.g_type
@@ -345,9 +347,11 @@ class Value(GObjectModule.Value):
elif gtype == TYPE_VARIANT:
return self.get_variant()
elif gtype == TYPE_PYOBJECT:
- pass
- else:
+ return self.get_boxed()
+ elif gtype == _gi.TYPE_INVALID:
return None
+ else:
+ return _gi._gvalue_get(self)
def __repr__(self):
return '<Value (%s) %s>' % (self.g_type.name, self.get_value())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]