Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | import numpy |
| 4 | 4 | from ._aubio import * |
| 5 | +from ._aubio import float_type | |
| 5 | 6 | from .midiconv import * |
| 6 | 7 | from .slicing import * |
| 7 | 8 | |
| @@ -10,6 +11,8 @@ class fvec(numpy.ndarray): · 2 unmodified lines | ||
| 10 | 11 | |
| 11 | 12 | def __new__(cls, input_arg=1024, **kwargs): |
| 12 | 13 | if isinstance(input_arg, int): |
| 14 | + if input_arg == 0: | |
| 15 | + raise ValueError("vector length of 1 or more expected") | |
| 13 | 16 | return numpy.zeros(input_arg, dtype=float_type, **kwargs) |
| 14 | 17 | else: |
| 15 | 18 | return numpy.array(input_arg, dtype=float_type, **kwargs) |