Permalink
Browse files

[gi-overrides] special case python 2 keywords that crept in

  • Loading branch information...
1 parent 83b0f8a commit 6367bffa006e94dc667d7008fccad8d47d8d3646 John (J5) Palmieri committed Mar 4, 2011
Showing with 9 additions and 5 deletions.
  1. +5 −1 gi/overrides/Gtk.py
  2. +4 −4 tests/test_overrides.py
View
@@ -759,7 +759,11 @@ def _convert_value(self, treeiter, column, value):
else:
raise ValueError('Expected an integer for column %i but got %s' % (column, type(value)))
elif type_ == GObject.TYPE_BOOLEAN:
- if isinstance(value, (int, long)):
+ cmp_classes = [int]
+ if sys.version_info < (3, 0):
+ cmp_classes.append(long)
+
+ if isinstance(value, tuple(cmp_classes)):
value = bool(value)
else:
raise ValueError('Expected a bool for column %i but got %s' % (column, type(value)))
@@ -7,7 +7,7 @@
import os
sys.path.insert(0, "../")
-from compathelper import _long, _unicode
+from compathelper import _long, _unicode, _bytes
from gi.repository import GLib
from gi.repository import GObject
@@ -715,11 +715,11 @@ class TestPyObject(object):
i % 2,
bool(i % 2),
i,
- sys.maxint + 1,
+ 9223372036854775808,
-9223372036854775808,
0xffffffffffffffff,
254,
- 'a'
+ _bytes('a')
))
# len gets the number of children in the root node
@@ -754,7 +754,7 @@ class TestPyObject(object):
uint_ = tree_store.get_value(treeiter, 8)
self.assertEquals(uint_, i)
ulong_ = tree_store.get_value(treeiter, 9)
- self.assertEquals(ulong_, sys.maxint + 1)
+ self.assertEquals(ulong_, 9223372036854775808)
int64_ = tree_store.get_value(treeiter, 10)
self.assertEquals(int64_, -9223372036854775808)
uint64_ = tree_store.get_value(treeiter, 11)

0 comments on commit 6367bff

Please sign in to comment.