From d02ca96090ea2fed97b7789a855668c1ddc98294 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 22 Oct 2020 15:07:38 -0500 Subject: MAINT: Simplify code path slightly --- numpy/core/src/multiarray/buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'numpy') diff --git a/numpy/core/src/multiarray/buffer.c b/numpy/core/src/multiarray/buffer.c index 5ba343d6d..3b3bba663 100644 --- a/numpy/core/src/multiarray/buffer.c +++ b/numpy/core/src/multiarray/buffer.c @@ -637,6 +637,8 @@ _buffer_get_info(PyObject *obj, int flags) item = PyList_GetItem(item_list, item_list_length - 1); old_info = (_buffer_info_t*)PyLong_AsVoidPtr(item); if (_buffer_info_cmp(info, old_info) != 0) { + old_info = NULL; /* Can't use this one, but possibly next */ + if (item_list_length > 1 && info->ndim > 1) { /* * Some arrays are C- and F-contiguous and if they have more @@ -654,9 +656,6 @@ _buffer_get_info(PyObject *obj, int flags) old_info = NULL; } } - else { - old_info = NULL; - } } if (old_info != NULL) { -- cgit v1.2.1