diff options
author | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-21 20:32:00 +0000 |
---|---|---|
committer | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-21 20:32:00 +0000 |
commit | 4df2827d58f92ea2a287ac780d6c32a0cdf50b6e (patch) | |
tree | 38de2097e0ceb5611780630061eef4eb68670060 | |
parent | 987c782a42834a9714c5ce402e479e448a9b55ba (diff) |
eval.c: Bug #1886 [ruby-core:24767]; ensure that rb_exc_raise and rb_exc_fatal require an exception object. Backport of r24403.
test/ruby/test_exception.rb: test for exception change. Backport of r24404.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | test/ruby/test_exception.rb | 9 |
3 files changed, 17 insertions, 1 deletions
@@ -1,6 +1,11 @@ +Tue Jun 22 04:29:00 Kirk Haines <khaines@ruby-lang.org> + + * eval.c: Bug #1886 [ruby-core:24767]; ensure that rb_exc_raise and rb_exc_fatal require an exception object. Backport of r24403. + * test/ruby/test_exception.rb: test for exception change. Backport of r24404. + Sat Jun 12 07:34:00 Kirk Haines <khaines@ruby-lang.org> - * configure.in: Backport #1710 [ruby-core:24104]; backport of r20573 to clean up handling of LIBPATHFLAG. + * configure.in: Backport #1710 [ruby-core:24104]; backport of r20573 to clean up handling of LIBPATHFLAG. r28291 Thu Jun 10 22:50:00 Kirk Haines <khaines@ruby-lang.org> @@ -4657,6 +4657,7 @@ void rb_exc_raise(mesg) VALUE mesg; { + mesg = rb_make_exception(1, &mesg); rb_longjmp(TAG_RAISE, mesg); } @@ -4664,6 +4665,7 @@ void rb_exc_fatal(mesg) VALUE mesg; { + mesg = rb_make_exception(1, &mesg); rb_longjmp(TAG_FATAL, mesg); } diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 4c27c52f3c..b31053f03e 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1,5 +1,11 @@ require 'test/unit' +class ZeroDivisionError + def self.new(message) + 42 + end +end + class TestException < Test::Unit::TestCase def test_exception begin @@ -21,6 +27,9 @@ class TestException < Test::Unit::TestCase end assert(true) + e = assert_raise(TypeError) { 1/0 } + assert_equal('exception class/object expected', e.message) + # exception in rescue clause $string = "this must be handled no.3" e = assert_raises(RuntimeError) do |