hdl.ast: fix some type checks.
authorwhitequark <cz@m-labs.hk>
Wed, 10 Apr 2019 04:33:44 +0000 (04:33 +0000)
committerwhitequark <cz@m-labs.hk>
Wed, 10 Apr 2019 04:33:44 +0000 (04:33 +0000)
nmigen/hdl/ast.py

index b64f7bfb4570fc8378a2d5f03f638f810e9b9ff0..3a4222094fc80a194c9b2d700dda062c3a55072d 100644 (file)
@@ -246,7 +246,8 @@ class Const(Value):
             shape = shape, self.value < 0
         self.nbits, self.signed = shape
         if not isinstance(self.nbits, int) or self.nbits < 0:
-            raise TypeError("Width must be a non-negative integer, not '{!r}'", self.nbits)
+            raise TypeError("Width must be a non-negative integer, not '{!r}'"
+                            .format(self.nbits))
         self.value = self.normalize(self.value, shape)
 
     def shape(self):
@@ -272,7 +273,8 @@ class AnyValue(Value, DUID):
             shape = shape, False
         self.nbits, self.signed = shape
         if not isinstance(self.nbits, int) or self.nbits < 0:
-            raise TypeError("Width must be a non-negative integer, not '{!r}'", self.nbits)
+            raise TypeError("Width must be a non-negative integer, not '{!r}'"
+                            .format(self.nbits))
 
     def shape(self):
         return self.nbits, self.signed