diff options
Diffstat (limited to 'dbus_bindings/int.c')
-rw-r--r-- | dbus_bindings/int.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dbus_bindings/int.c b/dbus_bindings/int.c index 696f93e..5944314 100644 --- a/dbus_bindings/int.c +++ b/dbus_bindings/int.c @@ -81,6 +81,12 @@ Boolean_tp_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs) } static PyObject * +Boolean_tp_str(PyObject *self) +{ + return PyUnicode_FromString(PyObject_IsTrue(self) ? "1" : "0"); +} + +static PyObject * Boolean_tp_repr(PyObject *self) { int is_true = PyObject_IsTrue(self); @@ -122,7 +128,7 @@ PyTypeObject DBusPyBoolean_Type = { 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - 0, /* tp_str */ + Boolean_tp_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ |