@@ -67,7 +67,7 @@ static nanobind::object mlirApiObjectToCapsule(nanobind::handle apiObject) {
6767template <>
6868struct type_caster <MlirAffineMap> {
6969 NB_TYPE_CASTER (MlirAffineMap, const_name(" MlirAffineMap" ))
70- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
70+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
7171 nanobind::object capsule = mlirApiObjectToCapsule (src);
7272 value = mlirPythonCapsuleToAffineMap (capsule.ptr ());
7373 if (mlirAffineMapIsNull (value)) {
@@ -90,7 +90,7 @@ struct type_caster<MlirAffineMap> {
9090template <>
9191struct type_caster <MlirAttribute> {
9292 NB_TYPE_CASTER (MlirAttribute, const_name(" MlirAttribute" ))
93- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
93+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
9494 nanobind::object capsule = mlirApiObjectToCapsule (src);
9595 value = mlirPythonCapsuleToAttribute (capsule.ptr ());
9696 return !mlirAttributeIsNull (value);
@@ -111,7 +111,7 @@ struct type_caster<MlirAttribute> {
111111template <>
112112struct type_caster <MlirBlock> {
113113 NB_TYPE_CASTER (MlirBlock, const_name(" MlirBlock" ))
114- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
114+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
115115 nanobind::object capsule = mlirApiObjectToCapsule (src);
116116 value = mlirPythonCapsuleToBlock (capsule.ptr ());
117117 return !mlirBlockIsNull (value);
@@ -122,7 +122,7 @@ struct type_caster<MlirBlock> {
122122template <>
123123struct type_caster <MlirContext> {
124124 NB_TYPE_CASTER (MlirContext, const_name(" MlirContext" ))
125- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
125+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
126126 if (src.is_none ()) {
127127 // Gets the current thread-bound context.
128128 // TODO: This raises an error of "No current context" currently.
@@ -142,7 +142,7 @@ struct type_caster<MlirContext> {
142142template <>
143143struct type_caster <MlirDialectRegistry> {
144144 NB_TYPE_CASTER (MlirDialectRegistry, const_name(" MlirDialectRegistry" ))
145- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
145+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
146146 nanobind::object capsule = mlirApiObjectToCapsule (src);
147147 value = mlirPythonCapsuleToDialectRegistry (capsule.ptr ());
148148 return !mlirDialectRegistryIsNull (value);
@@ -162,7 +162,7 @@ struct type_caster<MlirDialectRegistry> {
162162template <>
163163struct type_caster <MlirLocation> {
164164 NB_TYPE_CASTER (MlirLocation, const_name(" MlirLocation" ))
165- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
165+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
166166 if (src.is_none ()) {
167167 // Gets the current thread-bound context.
168168 src = nanobind::module_::import_ (MAKE_MLIR_PYTHON_QUALNAME (" ir" ))
@@ -188,7 +188,7 @@ struct type_caster<MlirLocation> {
188188template <>
189189struct type_caster <MlirModule> {
190190 NB_TYPE_CASTER (MlirModule, const_name(" MlirModule" ))
191- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
191+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
192192 nanobind::object capsule = mlirApiObjectToCapsule (src);
193193 value = mlirPythonCapsuleToModule (capsule.ptr ());
194194 return !mlirModuleIsNull (value);
@@ -209,12 +209,13 @@ template <>
209209struct type_caster <MlirFrozenRewritePatternSet> {
210210 NB_TYPE_CASTER (MlirFrozenRewritePatternSet,
211211 const_name (" MlirFrozenRewritePatternSet" ))
212- bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) {
212+ bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
213213 nanobind::object capsule = mlirApiObjectToCapsule (src);
214214 value = mlirPythonCapsuleToFrozenRewritePatternSet (capsule.ptr ());
215215 return value.ptr != nullptr ;
216216 }
217- static handle from_cpp (MlirFrozenRewritePatternSet v, rv_policy, handle) {
217+ static handle from_cpp (MlirFrozenRewritePatternSet v, rv_policy,
218+ handle) noexcept {
218219 nanobind::object capsule = nanobind::steal<nanobind::object>(
219220 mlirPythonFrozenRewritePatternSetToCapsule (v));
220221 return nanobind::module_::import_ (MAKE_MLIR_PYTHON_QUALNAME (" rewrite" ))
@@ -228,7 +229,7 @@ struct type_caster<MlirFrozenRewritePatternSet> {
228229template <>
229230struct type_caster <MlirOperation> {
230231 NB_TYPE_CASTER (MlirOperation, const_name(" MlirOperation" ))
231- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
232+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
232233 nanobind::object capsule = mlirApiObjectToCapsule (src);
233234 value = mlirPythonCapsuleToOperation (capsule.ptr ());
234235 return !mlirOperationIsNull (value);
@@ -250,7 +251,7 @@ struct type_caster<MlirOperation> {
250251template <>
251252struct type_caster <MlirValue> {
252253 NB_TYPE_CASTER (MlirValue, const_name(" MlirValue" ))
253- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
254+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
254255 nanobind::object capsule = mlirApiObjectToCapsule (src);
255256 value = mlirPythonCapsuleToValue (capsule.ptr ());
256257 return !mlirValueIsNull (value);
@@ -273,7 +274,7 @@ struct type_caster<MlirValue> {
273274template <>
274275struct type_caster <MlirPassManager> {
275276 NB_TYPE_CASTER (MlirPassManager, const_name(" MlirPassManager" ))
276- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
277+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
277278 nanobind::object capsule = mlirApiObjectToCapsule (src);
278279 value = mlirPythonCapsuleToPassManager (capsule.ptr ());
279280 return !mlirPassManagerIsNull (value);
@@ -284,7 +285,7 @@ struct type_caster<MlirPassManager> {
284285template <>
285286struct type_caster <MlirTypeID> {
286287 NB_TYPE_CASTER (MlirTypeID, const_name(" MlirTypeID" ))
287- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
288+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
288289 nanobind::object capsule = mlirApiObjectToCapsule (src);
289290 value = mlirPythonCapsuleToTypeID (capsule.ptr ());
290291 return !mlirTypeIDIsNull (value);
@@ -306,7 +307,7 @@ struct type_caster<MlirTypeID> {
306307template <>
307308struct type_caster <MlirType> {
308309 NB_TYPE_CASTER (MlirType, const_name(" MlirType" ))
309- bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) {
310+ bool from_python (handle src, uint8_t flags, cleanup_list *cleanup) noexcept {
310311 nanobind::object capsule = mlirApiObjectToCapsule (src);
311312 value = mlirPythonCapsuleToType (capsule.ptr ());
312313 return !mlirTypeIsNull (value);
0 commit comments