[前][次][番号順一覧][スレッド一覧]

ruby-changes:16390

From: wyhaines <ko1@a...>
Date: Tue, 22 Jun 2010 05:32:16 +0900 (JST)
Subject: [ruby-changes:16390] Ruby:r28374 (ruby_1_8_6): eval.c: Bug #1886 ; ensure that rb_exc_raise and rb_exc_fatal require an exception object. Backport of r24403.

wyhaines	2010-06-22 05:32:00 +0900 (Tue, 22 Jun 2010)

  New Revision: 28374

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28374

  Log:
    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.

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/eval.c
    branches/ruby_1_8_6/test/ruby/test_exception.rb

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 28373)
+++ ruby_1_8_6/ChangeLog	(revision 28374)
@@ -1,6 +1,11 @@
+Tue Jun 22 04:29:00 Kirk Haines <khaines@r...>
+
+	* 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@r...>
 
-	* 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@r...>
 
Index: ruby_1_8_6/test/ruby/test_exception.rb
===================================================================
--- ruby_1_8_6/test/ruby/test_exception.rb	(revision 28373)
+++ ruby_1_8_6/test/ruby/test_exception.rb	(revision 28374)
@@ -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 @@
     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
Index: ruby_1_8_6/eval.c
===================================================================
--- ruby_1_8_6/eval.c	(revision 28373)
+++ ruby_1_8_6/eval.c	(revision 28374)
@@ -4657,6 +4657,7 @@
 rb_exc_raise(mesg)
     VALUE mesg;
 {
+    mesg = rb_make_exception(1, &mesg);
     rb_longjmp(TAG_RAISE, mesg);
 }
 
@@ -4664,6 +4665,7 @@
 rb_exc_fatal(mesg)
     VALUE mesg;
 {
+    mesg = rb_make_exception(1, &mesg);
     rb_longjmp(TAG_FATAL, mesg);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]