Skip to content

Commit 3fca6c1

Browse files
mithrosbourdeauducq
authored andcommittedJan 3, 2016
Exception now has helpful string.
Before; ``` File "/usr/local/google/home/tansell/foss/timvideos/hdmi2usb/i2cslave/build/lib/python3.4/site-packages/migen-0.2-py3 .4.egg/migen/fhdl/structure.py", line 110, in __getitem__ raise TypeError TypeError ``` After; ``` File "/usr/local/google/home/tansell/foss/timvideos/hdmi2usb/i2cslave/build/lib/python3.4/site-packages/migen-0.2-py3.4.egg/migen/fhdl/structure.py", line 110, in __getitem__ raise TypeError("Can use type %s (%r) as key" % (type(key), key)) TypeError: Can use type <class 'migen.fhdl.structure.Signal'> (<Signal dbits at 0x7fd7836a2a90>) as key ```
1 parent 03bfb4b commit 3fca6c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

Diff for: ‎migen/fhdl/structure.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def __getitem__(self, key):
107107
return Cat(self[i] for i in range(start, stop, step))
108108
return _Slice(self, start, stop)
109109
else:
110-
raise TypeError
110+
raise TypeError("Can use type {} ({}) as key".format(
111+
type(key), repr(key)))
111112

112113
def eq(self, r):
113114
"""Assignment

2 commit comments

Comments
 (2)

jordens commented on Jan 4, 2016

@jordens
Member

But has it really? Looks like the string is wrong.

sbourdeauducq commented on Jan 5, 2016

@sbourdeauducq
Member

Fixed, thanks

Please sign in to comment.