ref: b96a7b88da69d30b3617fe6b25e91058a5c6189b
parent: 0df6e9e74771bc4ed536a2439749efb1bf7828ba
author: Paul Brossier <piem@piem.org>
date: Wed May 11 05:40:04 EDT 2016
python/lib/aubio/__init__.py: make sure length is not zero and float_type is imported
--- a/python/lib/aubio/__init__.py
+++ b/python/lib/aubio/__init__.py
@@ -2,6 +2,7 @@
import numpy
from ._aubio import *
+from ._aubio import float_type
from .midiconv import *
from .slicing import *
@@ -10,6 +11,8 @@
def __new__(cls, input_arg=1024, **kwargs):
if isinstance(input_arg, int):
+ if input_arg == 0:
+ raise ValueError("vector length of 1 or more expected")
return numpy.zeros(input_arg, dtype=float_type, **kwargs)
else:
return numpy.array(input_arg, dtype=float_type, **kwargs)