Skip to content

Commit 723f113

Browse files
committed
[C++] Make std::cerr only in debud mode for the check of convertibility
1 parent 92f9eb1 commit 723f113

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/details.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,26 +146,34 @@ namespace eigenpy
146146

147147
if (!PyArray_Check(obj_ptr))
148148
{
149+
#ifndef NDEBUG
149150
std::cerr << "The python object is not a numpy array." << std::endl;
151+
#endif
150152
return 0;
151153
}
152154

153155
if (PyArray_NDIM(obj_ptr) != 2)
154156
if ( (PyArray_NDIM(obj_ptr) !=1) || (! MatType::IsVectorAtCompileTime) )
155157
{
158+
#ifndef NDEBUG
156159
std::cerr << "The number of dimension of the object is not correct." << std::endl;
160+
#endif
157161
return 0;
158162
}
159163

160164
if ((PyArray_ObjectType(obj_ptr, 0)) != NumpyEquivalentType<T>::type_code)
161165
{
166+
#ifndef NDEBUG
162167
std::cerr << "The internal type as no Eigen equivalent." << std::endl;
168+
#endif
163169
return 0;
164170
}
165171

166172
if (!(PyArray_FLAGS(obj_ptr) & NPY_ALIGNED))
167173
{
174+
#ifndef NDEBUG
168175
std::cerr << "NPY non-aligned matrices are not implemented." << std::endl;
176+
#endif
169177
return 0;
170178
}
171179

0 commit comments

Comments
 (0)