Get calling getChecked in the python bindings

I was focusing on the MemRefType object in the python bindings, when I saw that the .get call here is actually calling MemRefType::getChecked. Although, there is CAPI for both get and getChecked. This is not only for MemRefType but applies to other types as well, so I was wondering if there is a reason for that, or if it’s a missing feature.

Uncheked get asserts if the arguments don’t let it build a valid type. C assert aborts the current process, which is utterly undesirable in Python. Checked get just emits an error, which is then propagated up as Python exception. This is intentional.

2 Likes