Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d045fef

Browse filesBrowse files
committed
Merge pull request #3811 from jbmohler/array_view_ctor
copy all array_view members in copy constructor
2 parents f05182d + bbff731 commit d045fef
Copy full SHA for d045fef

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed

‎src/numpy_cpp.h

Copy file name to clipboardExpand all lines: src/numpy_cpp.h
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,19 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
367367
}
368368
}
369369

370-
array_view(const array_view &other, bool contiguous = false) : m_arr(NULL), m_data(NULL)
370+
array_view(const array_view &other) : m_arr(NULL), m_data(NULL)
371371
{
372-
if (!set((PyObject *)other.m_arr)) {
373-
throw py::exception();
374-
}
372+
m_arr = other.m_arr;
373+
Py_XINCREF(m_arr);
374+
m_data = other.m_data;
375+
m_shape = other.m_shape;
376+
m_strides = other.m_strides;
375377
}
376378

377379
array_view(PyArrayObject *arr, char *data, npy_intp *shape, npy_intp *strides)
378380
{
379381
m_arr = arr;
380-
Py_INCREF(arr);
382+
Py_XINCREF(arr);
381383
m_data = data;
382384
m_shape = shape;
383385
m_strides = strides;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.