mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
ignore exception under rb_protect(). * test/ruby/test_exception.rb (test_exception_in_name_error_to_str): add a corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ab6c8910f4
commit
d61d9d5e8e
3 changed files with 29 additions and 1 deletions
5
error.c
5
error.c
|
@ -1012,6 +1012,7 @@ name_err_mesg_to_str(VALUE obj)
|
|||
else {
|
||||
const char *desc = 0;
|
||||
VALUE d = 0, args[NAME_ERR_MESG_COUNT];
|
||||
int state = 0;
|
||||
|
||||
obj = ptr[1];
|
||||
switch (TYPE(obj)) {
|
||||
|
@ -1025,7 +1026,9 @@ name_err_mesg_to_str(VALUE obj)
|
|||
desc = "false";
|
||||
break;
|
||||
default:
|
||||
d = rb_protect(rb_inspect, obj, 0);
|
||||
d = rb_protect(rb_inspect, obj, &state);
|
||||
if (state)
|
||||
rb_set_errinfo(Qnil);
|
||||
if (NIL_P(d) || RSTRING_LEN(d) > 65) {
|
||||
d = rb_any_to_s(obj);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue