summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2002-05-31 19:59:47 +0000
committerMatt Wilson <msw@src.gnome.org>2002-05-31 19:59:47 +0000
commit1f1541c7eda6b3ae8d47663d5953add37bfbd08a (patch)
tree040dc58ec493252eafa882f45e58a8ffa8729fd3
parenta4fc09ec25ca1440fab5c662893f510cdcf3465e (diff)
downloadpygobject-1f1541c7eda6b3ae8d47663d5953add37bfbd08a.tar.gz
pygobject-1f1541c7eda6b3ae8d47663d5953add37bfbd08a.tar.xz
pygobject-1f1541c7eda6b3ae8d47663d5953add37bfbd08a.zip
the path argument must be a tuple. Ints are not automatically converted to
2002-05-31 Matt Wilson <msw@redhat.com> * examples/pygtk-demo/demos/list_store.py (fixed_toggled): the path argument must be a tuple. Ints are not automatically converted to tuples any more. * pygtype.c (pyg_value_as_pyobject): change the behavior of G_TYPE_UINT to match the code generator's output on 32 bit systems.
-rw-r--r--gobject/pygtype.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index 0051d25..686e4a8 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -503,12 +503,15 @@ pyg_value_as_pyobject(const GValue *value)
return PyInt_FromLong(g_value_get_int(value));
case G_TYPE_UINT:
{
- gulong val = (gulong) g_value_get_uint(value);
-
- if (val <= G_MAXLONG)
- return PyInt_FromLong((glong) val);
- else
- return PyLong_FromUnsignedLong(val);
+ /* in Python, the Int object is backed by a long. If a
+ long can hold the whole value of an unsigned int, use
+ an Int. Otherwise, use a Long object to avoid overflow.
+ This matches the ULongArg behavior in codegen/argtypes.h */
+#if (G_MAXUINT <= G_MAXLONG)
+ return PyInt_FromLong((glong) g_value_get_uint(value));
+#else
+ return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value));
+#endif
}
case G_TYPE_LONG:
return PyInt_FromLong(g_value_get_long(value));