Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0e09d5

Browse files
committed
Assign m_arr = tmp in more cases
1 parent 2f29bdf commit c0e09d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/numpy_cpp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,11 +444,14 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
444444
m_shape = zeros;
445445
m_strides = zeros;
446446
if (PyArray_NDIM(tmp) == 0 && ND == 0) {
447+
m_arr = tmp;
447448
return 1;
448449
}
449450
}
450451
if (PyArray_NDIM(tmp) > 0 && PyArray_DIM(tmp, 0) == 0) {
451452
// accept dimension mismatch for empty arrays
453+
Py_XDECREF(m_arr);
454+
m_arr = tmp;
452455
return 1;
453456
}
454457
if (PyArray_NDIM(tmp) != ND) {

0 commit comments

Comments
 (0)