Fix: bt2: erroneous integer comparison of Field and Value
[babeltrace.git] / src / bindings / python / bt2 / bt2 / field.py
index 99daff5a036a675f090a39c5cbf2029b1704f900..f5b9b59645365bcfcca2079101986fa516109602 100644 (file)
@@ -250,6 +250,18 @@ class _IntegralField(_NumericField, numbers.Integral):
         self.value = self | other
         return self
 
+    def __lt__(self, other):
+        if not isinstance(other, numbers.Integral):
+            return super().__lt__(other);
+
+        return self._value < int(other)
+
+    def _spec_eq(self, other):
+        if not isinstance(other, numbers.Integral):
+            return super()._spec_eq(other);
+
+        return self._value == int(other)
+
 
 class _IntegerField(_IntegralField, _Field):
     pass
This page took 0.022882 seconds and 4 git commands to generate.