Skip to content

Commit ec17e8b

Browse files
committed
address: raise ValueError if wrong tuple length is used
Otherwise the Addres object will be initialize, but TypeError might be raised on attempt to use it.
1 parent faf517c commit ec17e8b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

alsa_midi/address.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def __new__(cls,
7070
tple: Any = (client_id, port_id)
7171
return tuple.__new__(cls, tple)
7272
elif isinstance(arg1, tuple):
73+
if len(arg1) != 2:
74+
raise ValueError("Wrong tuple length")
7375
tple: Any = (int(v) if v is not None else 0 for v in arg1)
7476
return tuple.__new__(cls, tple)
7577
else:

0 commit comments

Comments
 (0)