Skip to content

Support non-finite floats (NaN, Inf, -Inf) in round-trip conversion#8

Merged
nathanjmcdougall merged 2 commits into
mainfrom
non-finite-float-roundtrip
May 15, 2026
Merged

Support non-finite floats (NaN, Inf, -Inf) in round-trip conversion#8
nathanjmcdougall merged 2 commits into
mainfrom
non-finite-float-roundtrip

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

Remove the is_finite() guard in py_to_yaml_value so float('nan'), float('inf'), and float('-inf') convert to serde_yaml::Number, which natively supports these values. This fixes a ValueError when trying to write back YAML .nan/.inf/-.inf values that were read successfully.

Update Rust unit tests and add Python round-trip tests.

Remove the is_finite() guard in py_to_yaml_value so float('nan'),
float('inf'), and float('-inf') convert to serde_yaml::Number, which
natively supports these values. This fixes a ValueError when trying to
write back YAML .nan/.inf/-.inf values that were read successfully.

Update Rust unit tests and add Python round-trip tests.
@nathanjmcdougall nathanjmcdougall merged commit 96544f7 into main May 15, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant