[Mlir-commits] [mlir] [MLIR][Python] Improve Iterator performance. Don't `throw` in `dunderNext` methods. (PR #175377)

Maksim Levental llvmlistbot at llvm.org
Sat Jan 10 21:27:34 PST 2026


================
@@ -194,13 +194,14 @@ nb::object PyBlock::getCapsule() {
 // Collections.
 //------------------------------------------------------------------------------
 
-PyRegion PyRegionIterator::dunderNext() {
+nb::typed<nb::object, PyRegion> PyRegionIterator::dunderNext() {
----------------
makslevental wrote:

can't these just be `std::optional<PyRegion>` and the like? That way you wouldn't have to do an `nb::cast`...

https://github.com/llvm/llvm-project/pull/175377


More information about the Mlir-commits mailing list