Skip to content

Commit c08fc2a

Browse files
committed
tools/generate.py: changed asserts to exceptions.
1 parent fd40863 commit c08fc2a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/generate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ def cleanup(name):
209209
cast = '<int*>'
210210
else:
211211
assert False, arg
212-
print(' assert PyArray_TYPE(%s) == np.NPY_DOUBLE, "%s is not double"' % (var, var))
213-
print(' assert %s.ndim == 1, "%s has wrong dimensions"' % (var, var))
212+
print(' if PyArray_TYPE(%s) != np.NPY_DOUBLE:' % var)
213+
print(' raise Exception("%s is not double")' % var)
214+
print(' if %s.ndim != 1:' % var)
215+
print(' raise Exception("%s has wrong dimensions")' % var)
214216
print(' if not (PyArray_FLAGS(%s) & np.NPY_C_CONTIGUOUS):' % var)
215217
print(' %s = PyArray_GETCONTIGUOUS(%s)' % (var, var))
216218
print(' %s_data = %s%s.data' % (var, cast, var))

0 commit comments

Comments
 (0)