Skip to content

Commit bd4689b

Browse files
commiting fix - handle errors in equality comparison in exclude defaults
1 parent 5a32513 commit bd4689b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/serializers/fields.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ impl SerField {
7575
fn exclude_default(value: &Bound<'_, PyAny>, extra: &Extra, serializer: &CombinedSerializer) -> PyResult<bool> {
7676
if extra.exclude_defaults {
7777
if let Some(default) = serializer.get_default(value.py())? {
78-
if value.eq(default)? {
79-
return Ok(true);
78+
return match value.eq(default) {
79+
Ok(true) => Ok(true),
80+
Ok(false) => Ok(false),
81+
Err(_E) => Ok(false),
8082
}
8183
}
8284
}

0 commit comments

Comments
 (0)