Use write_unraisable to report errors loading type objects for ABC checks.

This commit is contained in:
Adam Reichold 2023-12-21 09:59:24 +01:00
parent c1f4db0a9b
commit 3c97167fd1
2 changed files with 8 additions and 4 deletions

View file

@ -256,8 +256,10 @@ impl PyTypeCheck for PyMapping {
PyDict::is_type_of(object)
|| get_mapping_abc(object.py())
.and_then(|abc| object.is_instance(abc))
// TODO: surface errors in this chain to the user
.unwrap_or(false)
.unwrap_or_else(|err| {
err.write_unraisable(object.py(), Some(object));
false
})
}
}

View file

@ -540,8 +540,10 @@ impl PyTypeCheck for PySequence {
|| PyTuple::is_type_of(object)
|| get_sequence_abc(object.py())
.and_then(|abc| object.is_instance(abc))
// TODO: surface errors in this chain to the user
.unwrap_or(false)
.unwrap_or_else(|err| {
err.write_unraisable(object.py(), Some(object));
false
})
}
}