diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-08 00:44:05 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-08 00:44:05 +0000 |
commit | 79634569e483d82874c9eaadf0d3a61c1b529fa8 (patch) | |
tree | aea23d11a3cde8a68741cb49dd69b7aff6d590af /error.c | |
parent | b7f40d86af3e98c4481caf1014ba5423901d4580 (diff) |
merge revision(s) 34028,34030:
* 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.
ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -955,6 +955,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)) { @@ -968,7 +969,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); } |