summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-07-28 14:01:03 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-07-28 14:01:03 +0000
commit207489d4171eb275fe0c2b54cfcf092bdba6406a (patch)
tree92cd5764a4134723d8e208e0d2e41258b2e12a32
parent3929301962e68613360ae231b1bda968b7e764de (diff)
downloadpygobject-207489d4171eb275fe0c2b54cfcf092bdba6406a.tar.gz
pygobject-207489d4171eb275fe0c2b54cfcf092bdba6406a.tar.xz
pygobject-207489d4171eb275fe0c2b54cfcf092bdba6406a.zip
If we're on python 2.3, also check for PyBool_Type.
* gobject/pygtype.c (pyg_type_from_object): If we're on python 2.3, also check for PyBool_Type. * tests/gtype.py (GTypeTest.testBoolType): New test
-rw-r--r--gobject/pygtype.c4
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/gtype.py15
3 files changed, 20 insertions, 0 deletions
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index 23e3066..edf01f0 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -133,6 +133,10 @@ pyg_type_from_object(PyObject *obj)
if (tp == &PyInt_Type)
return G_TYPE_INT;
+#if PY_VERSION_HEX >= 0x020300f0
+ else if (tp == &PyBool_Type)
+ return G_TYPE_BOOLEAN;
+#endif
else if (tp == &PyLong_Type)
return G_TYPE_LONG;
else if (tp == &PyFloat_Type)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6543375..1c332e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
tests = \
conversion.py \
enum.py \
+ gtype.py \
signal.py
PYTHONPATH = $(top_builddir):$(top_builddir)/gobject:$(top_srcdir):$(top_srcdir)/gtk
diff --git a/tests/gtype.py b/tests/gtype.py
new file mode 100644
index 0000000..b109102
--- /dev/null
+++ b/tests/gtype.py
@@ -0,0 +1,15 @@
+import unittest
+
+from common import gobject, gtk
+
+class GTypeTest(unittest.TestCase):
+ def testBoolType(self):
+ store = gtk.ListStore(gobject.TYPE_BOOLEAN)
+ assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
+ store = gtk.ListStore('gboolean')
+ assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
+ store = gtk.ListStore(bool)
+ assert store.get_column_type(0) == gobject.TYPE_BOOLEAN
+
+if __name__ == '__main__':
+ unittest.main()