aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Bindings/Python/IRAttributes.cpp
diff options
context:
space:
mode:
authorJeff Niu <jeff@modular.com>2022-08-12 23:35:38 -0400
committerJeff Niu <jeff@modular.com>2022-08-12 23:35:38 -0400
commitbca889524a23a10d7a32024b80d687e2b3a1360c (patch)
treeda7a18089a37353d87bb6c67108a522c1a115db1 /mlir/lib/Bindings/Python/IRAttributes.cpp
parent96da738dc516e8a183c3a6ac7091ab2da7ce5732 (diff)
downloadllvm-bca889524a23a10d7a32024b80d687e2b3a1360c.zip
llvm-bca889524a23a10d7a32024b80d687e2b3a1360c.tar.gz
llvm-bca889524a23a10d7a32024b80d687e2b3a1360c.tar.bz2
[mlir][python] add a todo to replace throw in dense array iterator
Diffstat (limited to 'mlir/lib/Bindings/Python/IRAttributes.cpp')
-rw-r--r--mlir/lib/Bindings/Python/IRAttributes.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/mlir/lib/Bindings/Python/IRAttributes.cpp b/mlir/lib/Bindings/Python/IRAttributes.cpp
index d8fc568b..cb59893 100644
--- a/mlir/lib/Bindings/Python/IRAttributes.cpp
+++ b/mlir/lib/Bindings/Python/IRAttributes.cpp
@@ -183,7 +183,6 @@ public:
c.def("__iter__", [](const PyDenseArrayAttribute<EltTy, DerivedT> &arr) {
return PyDenseArrayIterator(arr);
});
- // Bind a concat.
c.def("__add__", [](PyDenseArrayAttribute<EltTy, DerivedT> &arr,
py::list extras) {
std::vector<EltTy> values;
@@ -278,9 +277,9 @@ public:
PyArrayAttributeIterator &dunderIter() { return *this; }
PyAttribute dunderNext() {
- if (nextIndex >= mlirArrayAttrGetNumElements(attr.get())) {
+ // TODO: Throw is an inefficient way to stop iteration.
+ if (nextIndex >= mlirArrayAttrGetNumElements(attr.get()))
throw py::stop_iteration();
- }
return PyAttribute(attr.getContext(),
mlirArrayAttrGetElement(attr.get(), nextIndex++));
}