8000 Fixing segmentation fault scalar · xtensor-stack/xtensor-python@a26ca70 · GitHub
[go: up one dir, main page]

Skip to content

Commit a26ca70

Browse files
committed
Fixing segmentation fault scalar
1 parent 7cb644a commit a26ca70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/xtensor-python/pycontainer.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@ namespace xt
473473
template <class D>
474474
inline bool pycontainer<D>::is_contiguous() const noexcept
475475
{
476-
if (PyArray_CHKFLAGS(python_array(), NPY_ARRAY_C_CONTIGUOUS))
476+
if (this->strides().size() == 0)
477+
{
478+
return true;
479+
}
480+
else if (PyArray_CHKFLAGS(python_array(), NPY_ARRAY_C_CONTIGUOUS))
477481
{
478482
return 1 == this->strides().back();
479483
}

0 commit comments

Comments
 (0)
0