Skip to content

Commit e136e55

Browse files
byroothsbt
authored andcommitted
[ruby/json] Instantiate Parser with a kwsplat
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
1 parent 8018a31 commit e136e55

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/json/lib/json/common.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,12 @@ def parse(source, opts = nil)
219219
if opts.nil?
220220
Parser.new(source).parse
221221
else
222-
Parser.new(source, opts).parse
222+
# NB: The ** shouldn't be required, but we have to deal with
223+
# different versions of the `json` and `json_pure` gems being
224+
# loaded concurrently.
225+
# Prior to 2.7.3, `JSON::Ext::Parser` would only take kwargs.
226+
# Ref: https://github.com/ruby/json/issues/650
227+
Parser.new(source, **opts).parse
223228
end
224229
end
225230

0 commit comments

Comments
 (0)