Skip to content

Don't call to_json on the return value of as_json for Float::NAN#908

Merged
byroot merged 1 commit into
ruby:masterfrom
etiennebarrie:as_json_nan_does_not_call_to_json
Dec 2, 2025
Merged

Don't call to_json on the return value of as_json for Float::NAN#908
byroot merged 1 commit into
ruby:masterfrom
etiennebarrie:as_json_nan_does_not_call_to_json

Conversation

@etiennebarrie

Copy link
Copy Markdown
Contributor

If you use strict: true and the return value of as_json is not a native JSON type, TruffleRuby may call to_json on it, as opposed to CRuby or JRuby.

This only happens for Float::NAN, because we were lacking a check before calling to_json on the casted value.

@byroot byroot merged commit 28c57df into ruby:master Dec 2, 2025
37 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.

2 participants