Skip to content

Commit

Permalink
[ruby/json] Instantiate Parser with a kwsplat
Browse files Browse the repository at this point in the history
Prior to 2.7.3, `JSON::Ext::Parser` would only take kwargs.
So if json_pure 2.7.4 is loaded with `json <= 2.7.2` (or stdlib)
it blows up.

Ref: ruby/json#650
Fix: ruby/json#651

ruby/json@4d9dc98817
  • Loading branch information
byroot authored and hsbt committed Oct 26, 2024
1 parent 3339adf commit 8f52844
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/json/lib/json/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ def parse(source, opts = nil)
if opts.nil?
Parser.new(source).parse
else
Parser.new(source, opts).parse
# NB: The ** shouldn't be required, but we have to deal with
# different versions of the `json` and `json_pure` gems being
# loaded concurrently.
# Prior to 2.7.3, `JSON::Ext::Parser` would only take kwargs.
# Ref: https://github.com/ruby/json/issues/650
Parser.new(source, **opts).parse
end
end

Expand Down

0 comments on commit 8f52844

Please sign in to comment.