Commit 063562c9 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Allow Bitmask to be created from ints and longs but always store as long

We need a 64 bit integer, and previously the test failed because it was
already created from longs in various cases (e.g. when reading from a
parent e1c6f864
...@@ -443,10 +443,10 @@ class Int64Range(Gst.Int64Range): ...@@ -443,10 +443,10 @@ class Int64Range(Gst.Int64Range):
class Bitmask(Gst.Bitmask): class Bitmask(Gst.Bitmask):
def __init__(self, v): def __init__(self, v):
if not isinstance(v, int): if not isinstance(v, long) and not isinstance(v, int):
raise TypeError("%s is not an int." % (type(v))) raise TypeError("%s is not an int or long." % (type(v)))
self.v = v self.v = long(v)
def __str__(self): def __str__(self):
return hex(self.v) return hex(self.v)
...@@ -396,4 +396,4 @@ class TestBitmask(TestCase): ...@@ -396,4 +396,4 @@ class TestBitmask(TestCase):
Gst.init(None) Gst.init(None)
r = Gst.Bitmask(1 << 5) r = Gst.Bitmask(1 << 5)
self.assertEqual(str(r), '0x20') self.assertEqual(str(r), '0x20L')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment