Skip to content

Commit

Permalink
Better error if frames/channels are non-integers
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Oct 15, 2024
1 parent 25894e3 commit f37a6ef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sounddevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,15 @@ def check_out(self, out, frames, channels, dtype, mapping):
channels = len(np.atleast_1d(mapping))
if dtype is None:
dtype = default.dtype['input']
out = np.empty((frames, channels), dtype, order='C')
try:
out = np.empty((frames, channels), dtype, order='C')
except TypeError as e:
from numbers import Integral
if not isinstance(frames, Integral):
raise TypeError("'frames' must be an integer") from e
if not isinstance(channels, Integral):
raise TypeError("'channels' must be an integer") from e
raise e
else:
frames, channels = out.shape
dtype = out.dtype
Expand Down

0 comments on commit f37a6ef

Please sign in to comment.