[pygobject/pygobject-3-4] Work around wrong 64 bit constants in GLib Gir
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-4] Work around wrong 64 bit constants in GLib Gir
- Date: Wed, 24 Oct 2012 05:32:42 +0000 (UTC)
commit 4922b050d91cd3943ef36bc8ca3fab9cf9522121
Author: Martin Pitt <martinpitt gnome org>
Date: Wed Oct 24 07:28:10 2012 +0200
Work around wrong 64 bit constants in GLib Gir
GLib's gir currently has wrong constants for MININT64 and MAXUINT64; explicitly
set them in an override, until this gets fixed properly.
https://bugzilla.gnome.org/show_bug.cgi?id=685022
gi/overrides/GLib.py | 8 ++++++++
tests/test_gi.py | 9 +++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index b6f2ce2e..cc5dea2 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -406,3 +406,11 @@ setattr(Variant, 'new_tuple', new_tuple)
setattr(Variant, 'get_string', get_string)
__all__.append('Variant')
+
+
+# work around wrong constants in GLib GIR, see
+# https://bugzilla.gnome.org/show_bug.cgi?id=685022
+MININT64 = -9223372036854775808
+MAXUINT64 = 18446744073709551615
+__all__.append('MININT64')
+__all__.append('MAXUINT64')
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 51cb6f9..315867a 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -64,6 +64,15 @@ class TestConstant(unittest.TestCase):
def test_constant_number(self):
self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER)
+ def test_min_max_int(self):
+ self.assertEqual(GLib.MAXINT32, 2 ** 31 - 1)
+ self.assertEqual(GLib.MININT32, -2 ** 31)
+ self.assertEqual(GLib.MAXUINT32, 2 ** 32 - 1)
+
+ self.assertEqual(GLib.MAXINT64, 2 ** 63 - 1)
+ self.assertEqual(GLib.MININT64, -2 ** 63)
+ self.assertEqual(GLib.MAXUINT64, 2 ** 64 - 1)
+
class TestBoolean(unittest.TestCase):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]