ListStore & python3



Hi,

I'm trying to have my application run under both python2 and 3, and I'm
having a surprising problem.

I have a gtk.ListStore with a column that has to hold integers between
2^32 and 2^64, what would be long's in python2.

If I build it with gtk.ListStore(int, ...) in python3 my int's get
chopped to 32bits, which is pretty surprising, because in python2 a
ListStore(long,...) does the correct thing.

So I used GObject.TYPE_UINT64 and I can add rows with
ls.append(big_integer_value) in both versions.

The problem is that it's pretty slow, so I dug
.insert_with_valuesv(-1,[0,...], [big_integer_value,...]) from the API.

On python2, this is perfectly fine, I give it a long, and in the
ListStore I get a guint64 with the right value.

On python3, I give an int (between 2^32 and 2^64) and in the ListStore I
get a guint64 truncated at 32bit, which is BAD, and definitely not what
I expected.

I can get around this with an explicit cast:
Object.Value(GObject.TYPE_UINT64, addr)
but this way I lose all the speed I gained, while python2 manages to do
the right thing without any expensive cast.

Did I get something wrong?

Thanks.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]