54a73a57a2 (master): [ruby/json] Test and restore behavior around to_json changing depth

0 views
Skip to first unread message

Étienne Barrié

unread,
8:49 AM (11 hours ago) 8:49 AM
to ruby...@g.ruby-lang.org
Étienne Barrié 2025-11-27 15:12:17 +0000 (Thu, 27 Nov 2025)

New Revision: 54a73a57a2

https://github.com/ruby/ruby/commit/54a73a57a2

Log:
[ruby/json] Test and restore behavior around to_json changing depth

When serializing an Array, and one of the elements of the Array requires
calling `to_json`, if the depth is changed, it will be used for the next
entries, which wasn't the case before
https://github.com/ruby/json/commit/5abd43490714, and is not the case with
TruffleRuby and JRuby.

Additionally, with TruffleRuby and JRuby the state's depth after the
`to_json` call is used to close the Array, which isn't the case with
CRuby.

https://github.com/ruby/json/commit/386b36fde5

Modified files:
ext/json/generator/generator.c
test/json/json_generator_test.rb
Reply all
Reply to author
Forward
0 new messages