Skip to content

Commit 2c18089

Browse files
committed
[std-array] array_indexing_suite::delete_item and ::delete_slice will throw Python exceptions
1 parent f4d61cc commit 2c18089

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

include/eigenpy/std-array.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ class array_indexing_suite
4040
template <class Class>
4141
static void extension_def(Class &) {}
4242

43-
// no-op
44-
static void delete_item(Container &, index_type) {}
45-
// no-op
46-
// no-op
47-
static void delete_slice(Container &, index_type, index_type) {}
43+
// throws exception
44+
static void delete_item(Container &, index_type) {
45+
PyErr_SetString(PyExc_NotImplementedError,
46+
"Cannot delete item from std::array type.");
47+
bp::throw_error_already_set();
48+
}
49+
50+
// throws exception
51+
static void delete_slice(Container &, index_type, index_type) {
52+
PyErr_SetString(PyExc_NotImplementedError,
53+
"Cannot delete slice from std::array type.");
54+
bp::throw_error_already_set();
55+
}
4856

4957
static void set_slice(Container &container, index_type from, index_type to,
5058
data_type const &v) {

0 commit comments

Comments
 (0)