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
GstStructure).
This commit is contained in:
Sebastian Dröge 2018-02-22 10:58:48 +01:00
parent e1c6f864b2
commit 063562c986
2 changed files with 4 additions and 4 deletions

View file

@ -443,10 +443,10 @@ class Int64Range(Gst.Int64Range):
class Bitmask(Gst.Bitmask):
def __init__(self, v):
if not isinstance(v, int):
raise TypeError("%s is not an int." % (type(v)))
if not isinstance(v, long) and not isinstance(v, int):
raise TypeError("%s is not an int or long." % (type(v)))
self.v = v
self.v = long(v)
def __str__(self):
return hex(self.v)

View file

@ -396,4 +396,4 @@ class TestBitmask(TestCase):
Gst.init(None)
r = Gst.Bitmask(1 << 5)
self.assertEqual(str(r), '0x20')
self.assertEqual(str(r), '0x20L')