From 79697ad84fa73b49cca2b6380a74a0bfce4b32bc Mon Sep 17 00:00:00 2001 From: Simon Gibbons Date: Sun, 18 Feb 2018 16:19:38 +0000 Subject: BUG: Correctly identify comma seperated dtype strings When parsing dtype strings, we should only consider them to be comma seperated if there are commas not present in a pair of square brackets. Whilst we had a check for this already in the code there was an off by 1 bug where we failed to consider the first character of the string. This would lead to an infinite recursion when trying to parse strings of the form `[i8,f8]`. Fixes: #10440 --- numpy/core/src/multiarray/descriptor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core/src') diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index 897155238..b4a0ce37d 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -198,7 +198,7 @@ _check_for_commastring(char *type, Py_ssize_t len) * allows commas inside of [], for parameterized dtypes to use. */ sqbracket = 0; - for (i = 1; i < len; i++) { + for (i = 0; i < len; i++) { switch (type[i]) { case ',': if (sqbracket == 0) { -- cgit v1.2.1