Skip to content

Commit 24a2b08

Browse files
committed
ResumableParser: Reset err_info on EOS errors
Fix: #1008 I'm unfortunately unable to turn the reproduction script into a test case there, I don't understand what is causing `err_info` to be re-raised in the repro that doesn't work in test-unit. ```ruby require 'json' parser = JSON::ResumableParser.new({}) ['{"message": "hello ', 'world"}', '[1,2]'].each do |chunk| parser << chunk begin while parser.parse p parser.value end rescue JSON::ParserError => e p e parser.clear end end ```
1 parent 68bcf60 commit 24a2b08

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ext/json/ext/parser/parser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,7 @@ static VALUE cResumableParser_parse(VALUE self)
24122412
complete = false;
24132413
if (RTEST(rb_ivar_get(rb_errinfo(), rb_intern("@eos")))) {
24142414
complete = false; // is an EOS error
2415+
rb_set_errinfo(Qnil);
24152416
} else {
24162417
rb_jump_tag(status); // reraise
24172418
}

0 commit comments

Comments
 (0)