diff options
author | Matt Wilson <msw@redhat.com> | 2002-05-31 19:59:47 +0000 |
---|---|---|
committer | Matt Wilson <msw@src.gnome.org> | 2002-05-31 19:59:47 +0000 |
commit | 727fde487f4598495ca17886cbe2f13768afe741 (patch) | |
tree | 9cd550efad452d2fd6aec50073ae9ef7f01534a2 /pygtype.c | |
parent | 5b30190d9ba9f274ee904cf445ebed49c2656f2e (diff) | |
download | pygtk-727fde487f4598495ca17886cbe2f13768afe741.tar.gz |
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.
Diffstat (limited to 'pygtype.c')
-rw-r--r-- | pygtype.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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)); |