merge revision(s) r45178,r45180,r45183: [Backport #9568]

eval.c: remove unneeded GC guard

	* eval.c (setup_exception): remove RB_GC_GUARD which is no longer
  needed since r41598.
	* eval.c (setup_exception): preserve errinfo across calling #to_s
	  method on the exception.  [ruby-core:61091] [Bug #9568]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-05-29 15:19:03 +00:00
parent 74d6b68229
commit fca433e2fd
4 changed files with 34 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Fri May 30 00:13:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (setup_exception): preserve errinfo across calling #to_s
method on the exception. [ruby-core:61091] [Bug #9568]
Thu May 29 20:57:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (ruby_num_interval_step_size): check signs and get rid

5
eval.c
View file

@ -507,9 +507,12 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
mesg = e;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
RB_GC_GUARD(e) = rb_obj_as_string(e);
th->errinfo = Qnil;
e = rb_obj_as_string(mesg);
th->errinfo = mesg;
if (file && line) {
warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
rb_obj_classname(th->errinfo), file, line, e);

View file

@ -78,6 +78,28 @@ class TestException < Test::Unit::TestCase
assert(!bad)
end
def test_errinfo_in_debug
bug9568 = EnvUtil.labeled_class("[ruby-core:61091] [Bug #9568]", RuntimeError) do
def to_s
require '\0'
rescue LoadError
self.class.to_s
end
end
err = EnvUtil.verbose_warning do
assert_raise(bug9568) do
$DEBUG, debug = true, $DEBUG
begin
raise bug9568
ensure
$DEBUG = debug
end
end
end
assert_include(err, bug9568.to_s)
end
def test_break_ensure
bad = true
while true

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-05-29"
#define RUBY_PATCHLEVEL 116
#define RUBY_RELEASE_DATE "2014-05-30"
#define RUBY_PATCHLEVEL 117
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 29
#define RUBY_RELEASE_DAY 30
#include "ruby/version.h"