Issue #7755 has been reported by marcandre (Marc-Andre Lafortune). ---------------------------------------- Bug #7755: JSON::Generate#configure's argument conversion https://bugs.ruby-lang.org/issues/7755 Author: marcandre (Marc-Andre Lafortune) Status: Open Priority: Low Assignee: naruse (Yui NARUSE) Category: ext Target version: 2.0.0 ruby -v: r38977 I notice a tiny bug in ext/json/generator/generator.c:514 tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); if (NIL_P(tmp)) { rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); } opts = tmp; Bug is that rb_convert_type never returns nil. Either both rb_convert_type are changed to rb_check_convert_type, or these lines are simply replaced by: opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); I'd recommend this last option, for consistency with the rest of MRI.
on 2013-01-29 20:34
on 2013-01-29 20:48
Issue #7755 has been updated by marcandre (Marc-Andre Lafortune). Subject changed from JSON::Generate#configure's argument conversion to JSON::Generate#configure's argument conversion There's some more unreachable code in ext/json/parser/parser.rl:629 ---------------------------------------- Bug #7755: JSON::Generate#configure's argument conversion https://bugs.ruby-lang.org/issues/7755#change-35704 Author: marcandre (Marc-Andre Lafortune) Status: Open Priority: Low Assignee: naruse (Yui NARUSE) Category: ext Target version: 2.0.0 ruby -v: r38977 I notice a tiny bug in ext/json/generator/generator.c:514 tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); if (NIL_P(tmp)) { rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); } opts = tmp; Bug is that rb_convert_type never returns nil. Either both rb_convert_type are changed to rb_check_convert_type, or these lines are simply replaced by: opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); I'd recommend this last option, for consistency with the rest of MRI.
on 2013-02-17 11:53
Issue #7755 has been updated by naruse (Yui NARUSE). Target version changed from 2.0.0 to next minor Could you report it to upstream? https://github.com/flori/json ---------------------------------------- Bug #7755: JSON::Generate#configure's argument conversion https://bugs.ruby-lang.org/issues/7755#change-36426 Author: marcandre (Marc-Andre Lafortune) Status: Open Priority: Low Assignee: naruse (Yui NARUSE) Category: ext Target version: next minor ruby -v: r38977 I notice a tiny bug in ext/json/generator/generator.c:514 tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); if (NIL_P(tmp)) { rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); } opts = tmp; Bug is that rb_convert_type never returns nil. Either both rb_convert_type are changed to rb_check_convert_type, or these lines are simply replaced by: opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); I'd recommend this last option, for consistency with the rest of MRI.
on 2013-02-18 04:06
Issue #7755 has been updated by marcandre (Marc-Andre Lafortune). Filed as https://github.com/flori/json/issues/162 ---------------------------------------- Bug #7755: JSON::Generate#configure's argument conversion https://bugs.ruby-lang.org/issues/7755#change-36482 Author: marcandre (Marc-Andre Lafortune) Status: Open Priority: Low Assignee: naruse (Yui NARUSE) Category: ext Target version: next minor ruby -v: r38977 I notice a tiny bug in ext/json/generator/generator.c:514 tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); if (NIL_P(tmp)) { rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); } opts = tmp; Bug is that rb_convert_type never returns nil. Either both rb_convert_type are changed to rb_check_convert_type, or these lines are simply replaced by: opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); I'd recommend this last option, for consistency with the rest of MRI.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.