@@ -67,7 +67,7 @@ static nanobind::object mlirApiObjectToCapsule(nanobind::handle apiObject) {
67
67
template <>
68
68
struct type_caster <MlirAffineMap> {
69
69
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 {
71
71
nanobind::object capsule = mlirApiObjectToCapsule (src);
72
72
value = mlirPythonCapsuleToAffineMap (capsule.ptr ());
73
73
if (mlirAffineMapIsNull (value)) {
@@ -90,7 +90,7 @@ struct type_caster<MlirAffineMap> {
90
90
template <>
91
91
struct type_caster <MlirAttribute> {
92
92
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 {
94
94
nanobind::object capsule = mlirApiObjectToCapsule (src);
95
95
value = mlirPythonCapsuleToAttribute (capsule.ptr ());
96
96
return !mlirAttributeIsNull (value);
@@ -111,7 +111,7 @@ struct type_caster<MlirAttribute> {
111
111
template <>
112
112
struct type_caster <MlirBlock> {
113
113
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 {
115
115
nanobind::object capsule = mlirApiObjectToCapsule (src);
116
116
value = mlirPythonCapsuleToBlock (capsule.ptr ());
117
117
return !mlirBlockIsNull (value);
@@ -122,7 +122,7 @@ struct type_caster<MlirBlock> {
122
122
template <>
123
123
struct type_caster <MlirContext> {
124
124
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 {
126
126
if (src.is_none ()) {
127
127
// Gets the current thread-bound context.
128
128
// TODO: This raises an error of "No current context" currently.
@@ -142,7 +142,7 @@ struct type_caster<MlirContext> {
142
142
template <>
143
143
struct type_caster <MlirDialectRegistry> {
144
144
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 {
146
146
nanobind::object capsule = mlirApiObjectToCapsule (src);
147
147
value = mlirPythonCapsuleToDialectRegistry (capsule.ptr ());
148
148
return !mlirDialectRegistryIsNull (value);
@@ -162,7 +162,7 @@ struct type_caster<MlirDialectRegistry> {
162
162
template <>
163
163
struct type_caster <MlirLocation> {
164
164
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 {
166
166
if (src.is_none ()) {
167
167
// Gets the current thread-bound context.
168
168
src = nanobind::module_::import_ (MAKE_MLIR_PYTHON_QUALNAME (" ir" ))
@@ -188,7 +188,7 @@ struct type_caster<MlirLocation> {
188
188
template <>
189
189
struct type_caster <MlirModule> {
190
190
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 {
192
192
nanobind::object capsule = mlirApiObjectToCapsule (src);
193
193
value = mlirPythonCapsuleToModule (capsule.ptr ());
194
194
return !mlirModuleIsNull (value);
@@ -209,12 +209,13 @@ template <>
209
209
struct type_caster <MlirFrozenRewritePatternSet> {
210
210
NB_TYPE_CASTER (MlirFrozenRewritePatternSet,
211
211
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 {
213
213
nanobind::object capsule = mlirApiObjectToCapsule (src);
214
214
value = mlirPythonCapsuleToFrozenRewritePatternSet (capsule.ptr ());
215
215
return value.ptr != nullptr ;
216
216
}
217
- static handle from_cpp (MlirFrozenRewritePatternSet v, rv_policy, handle) {
217
+ static handle from_cpp (MlirFrozenRewritePatternSet v, rv_policy,
218
+ handle) noexcept {
218
219
nanobind::object capsule = nanobind::steal<nanobind::object>(
219
220
mlirPythonFrozenRewritePatternSetToCapsule (v));
220
221
return nanobind::module_::import_ (MAKE_MLIR_PYTHON_QUALNAME (" rewrite" ))
@@ -228,7 +229,7 @@ struct type_caster<MlirFrozenRewritePatternSet> {
228
229
template <>
229
230
struct type_caster <MlirOperation> {
230
231
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 {
232
233
nanobind::object capsule = mlirApiObjectToCapsule (src);
233
234
value = mlirPythonCapsuleToOperation (capsule.ptr ());
234
235
return !mlirOperationIsNull (value);
@@ -250,7 +251,7 @@ struct type_caster<MlirOperation> {
250
251
template <>
251
252
struct type_caster <MlirValue> {
252
253
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 {
254
255
nanobind::object capsule = mlirApiObjectToCapsule (src);
255
256
value = mlirPythonCapsuleToValue (capsule.ptr ());
256
257
return !mlirValueIsNull (value);
@@ -273,7 +274,7 @@ struct type_caster<MlirValue> {
273
274
template <>
274
275
struct type_caster <MlirPassManager> {
275
276
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 {
277
278
nanobind::object capsule = mlirApiObjectToCapsule (src);
278
279
value = mlirPythonCapsuleToPassManager (capsule.ptr ());
279
280
return !mlirPassManagerIsNull (value);
@@ -284,7 +285,7 @@ struct type_caster<MlirPassManager> {
284
285
template <>
285
286
struct type_caster <MlirTypeID> {
286
287
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 {
288
289
nanobind::object capsule = mlirApiObjectToCapsule (src);
289
290
value = mlirPythonCapsuleToTypeID (capsule.ptr ());
290
291
return !mlirTypeIDIsNull (value);
@@ -306,7 +307,7 @@ struct type_caster<MlirTypeID> {
306
307
template <>
307
308
struct type_caster <MlirType> {
308
309
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 {
310
311
nanobind::object capsule = mlirApiObjectToCapsule (src);
311
312
value = mlirPythonCapsuleToType (capsule.ptr ());
312
313
return !mlirTypeIsNull (value);
0 commit comments