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

ruby-changes:39442

From: nagachika <ko1@a...>
Date: Tue, 11 Aug 2015 02:09:07 +0900 (JST)
Subject: [ruby-changes:39442] nagachika:r51523 (ruby_2_2): merge revision(s) 51213: [Backport #11344]

nagachika	2015-08-11 02:08:37 +0900 (Tue, 11 Aug 2015)

  New Revision: 51523

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

  Log:
    merge revision(s) 51213: [Backport #11344]
    
    * lib/timeout.rb (ExitException): removed internal exception class
      and use Timeout::Error instead, as using throw/catch to isolate
      each timeouts now.  [ruby-dev:49179] [Bug #11344]
    
    * lib/timeout.rb (ExitException): leave Timeout::ExitException as an
      alias of Timeout::Error for backward compatibility in stable branch.
      [ruby-dev:49179] [Bug #11344]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/lib/timeout.rb
    branches/ruby_2_2/test/test_timeout.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 51522)
+++ ruby_2_2/ChangeLog	(revision 51523)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Tue Aug 11 01:51:53 2015 CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* lib/timeout.rb (ExitException): leave Timeout::ExitException as an
+	  alias of Timeout::Error for backward compatibility in stable branch.
+	  [ruby-dev:49179] [Bug #11344]
+
+Tue Aug 11 01:51:53 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/timeout.rb (ExitException): removed internal exception class
+	  and use Timeout::Error instead, as using throw/catch to isolate
+	  each timeouts now.  [ruby-dev:49179] [Bug #11344]
+
 Tue Aug 11 01:37:28 2015  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* test/net/http/test_httpresponse.rb
Index: ruby_2_2/lib/timeout.rb
===================================================================
--- ruby_2_2/lib/timeout.rb	(revision 51522)
+++ ruby_2_2/lib/timeout.rb	(revision 51523)
@@ -24,8 +24,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/timeout.rb#L24
 module Timeout
   # Raised by Timeout#timeout when the block times out.
   class Error < RuntimeError
-  end
-  class ExitException < ::Exception # :nodoc:
     attr_reader :thread
 
     def self.catch(*args)
@@ -46,6 +44,7 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/timeout.rb#L44
       self
     end
   end
+  ExitException = Error
 
   # :stopdoc:
   THIS_FILE = /\A#{Regexp.quote(__FILE__)}:/o
@@ -101,7 +100,7 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/timeout.rb#L100
         bt = e.backtrace
       end
     else
-      bt = ExitException.catch(message, &bl)
+      bt = Error.catch(message, &bl)
     end
     rej = /\A#{Regexp.quote(__FILE__)}:#{__LINE__-4}\z/o
     bt.reject! {|m| rej =~ m}
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 51522)
+++ ruby_2_2/version.h	(revision 51523)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-08-11"
-#define RUBY_PATCHLEVEL 155
+#define RUBY_PATCHLEVEL 156
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/test/test_timeout.rb
===================================================================
--- ruby_2_2/test/test_timeout.rb	(revision 51522)
+++ ruby_2_2/test/test_timeout.rb	(revision 51523)
@@ -63,9 +63,9 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/test_timeout.rb#L63
   end
 
   def test_exit_exception
-    assert_raise_with_message(Timeout::ExitException, "boon") do
-      Timeout.timeout(10, Timeout::ExitException) do
-        raise Timeout::ExitException, "boon"
+    assert_raise_with_message(Timeout::Error, "boon") do
+      Timeout.timeout(10, Timeout::Error) do
+        raise Timeout::Error, "boon"
       end
     end
   end
@@ -80,4 +80,21 @@ class TestTimeout < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/test_timeout.rb#L80
       Timeout.timeout(0.01) {e.next}
     end
   end
+
+  def test_handle_interrupt
+    bug11344 = '[ruby-dev:49179] [Bug #11344]'
+    ok = false
+    assert_raise(Timeout::Error) {
+      Thread.handle_interrupt(Timeout::Error => :never) {
+        Timeout.timeout(0.01) {
+          sleep 0.2
+          ok = true
+          Thread.handle_interrupt(Timeout::Error => :on_blocking) {
+            sleep 0.2
+          }
+        }
+      }
+    }
+    assert(ok, bug11344)
+  end
 end

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51213


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

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