File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -744,6 +744,11 @@ namespace xt
744744 template <class T , layout_type L>
745745 inline void pyarray<T, L>::init_from_python()
746746 {
747+ if (!static_cast <bool >(*this ))
748+ {
749+ return ;
750+ }
751+
747752 m_shape = inner_shape_type (reinterpret_cast <size_type*>(PyArray_SHAPE (this ->python_array ())),
748753 static_cast <size_type>(PyArray_NDIM (this ->python_array ())));
749754 m_strides = inner_strides_type (reinterpret_cast <difference_type*>(PyArray_STRIDES (this ->python_array ())),
Original file line number Diff line number Diff line change @@ -442,6 +442,11 @@ namespace xt
442442 template <class T , std::size_t N, layout_type L>
443443 inline void pytensor<T, N, L>::init_from_python()
444444 {
445+ if (!static_cast <bool >(*this ))
446+ {
447+ return ;
448+ }
449+
445450 if (PyArray_NDIM (this ->python_array ()) != N)
446451 {
447452 throw std::runtime_error (" NumPy: ndarray has incorrect number of dimensions" );
You can’t perform that action at this time.
0 commit comments