Skip to content

Commit

Permalink
hdl.ast: fix some type checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Apr 10, 2019
1 parent 0a2a702 commit 50fa251
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nmigen/hdl/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def __init__(self, value, shape=None):
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):
Expand All @@ -272,7 +273,8 @@ def __init__(self, shape):
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
Expand Down

0 comments on commit 50fa251

Please sign in to comment.