aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-07 20:00:09 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-07 20:00:09 +0000
commit9bb7dfa247b0dd1bb3ad1f596720d205835c6201 (patch)
treeb56dce213e629546cd2663c9bd6a6227aa477c5d
parent554577015f81be1427207dcf262739c1844d06d8 (diff)
downloadruby-9bb7dfa247b0dd1bb3ad1f596720d205835c6201.tar.gz
normalize reference to Timeout::Error
From: John Bachir <j@jjb.cc> * bootstraptest/test_io.rb (assert_finish): normalize rescue for Timeout::Error * lib/net/ftp.rb (Net#read_timeout): ditto for doc * lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass * lib/webrick/httprequest.rb (_read_data): ditto for rescue * sample/timeout.rb (p timeout): ditto for call * test/drb/drbtest.rb (test_06_timeout): ditto * test/ruby/test_readpartial.rb (test_open_pipe): ditto * test/thread/test_queue.rb (test_queue_thread_raise): ditto * thread.c (rb_thread_s_handle_interrupt): ditto for doc [ruby-core:65481] [misc #10339] TimeoutError is a legacy constant, Timeout::Error is the canonical constant. This patch normalizes all code and comments to reference Timeout::Error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog14
-rw-r--r--bootstraptest/test_io.rb2
-rw-r--r--lib/net/ftp.rb2
-rw-r--r--lib/resolv.rb2
-rw-r--r--lib/webrick/httprequest.rb2
-rw-r--r--sample/timeout.rb2
-rw-r--r--test/drb/drbtest.rb4
-rw-r--r--test/ruby/test_readpartial.rb4
-rw-r--r--test/thread/test_queue.rb2
-rw-r--r--thread.c22
10 files changed, 35 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 532409147d..06170d6265 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Wed Oct 8 04:58:48 2014 John Bachir <j@jjb.cc>
+
+ * bootstraptest/test_io.rb (assert_finish):
+ normalize rescue for Timeout::Error
+ * lib/net/ftp.rb (Net#read_timeout): ditto for doc
+ * lib/resolv.rb (Resolv::ResolvTimeout): ditto for subclass
+ * lib/webrick/httprequest.rb (_read_data): ditto for rescue
+ * sample/timeout.rb (p timeout): ditto for call
+ * test/drb/drbtest.rb (test_06_timeout): ditto
+ * test/ruby/test_readpartial.rb (test_open_pipe): ditto
+ * test/thread/test_queue.rb (test_queue_thread_raise): ditto
+ * thread.c (rb_thread_s_handle_interrupt): ditto for doc
+ [ruby-core:65481] [misc #10339]
+
Wed Oct 8 04:38:29 2014 Rei Odaira <Rei.Odaira@gmail.com>
* test/ruby/test_process.rb (TestProcess#test_setsid): AIX
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index cee8cb399e..1d2b19368a 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -26,7 +26,7 @@ assert_finish 10, %q{
t1.join
t2.join
end
- rescue LoadError, TimeoutError, NotImplementedError
+ rescue LoadError, Timeout::Error, NotImplementedError
end
}, '[ruby-dev:32566]'
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 6b452b8a75..c64bb5c682 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -103,7 +103,7 @@ module Net
# Number of seconds to wait for one block to be read (via one read(2)
# call). Any number may be used, including Floats for fractional
# seconds. If the FTP object cannot read data in this many seconds,
- # it raises a TimeoutError exception. The default value is 60 seconds.
+ # it raises a Timeout::Error exception. The default value is 60 seconds.
attr_reader :read_timeout
# Setter for the read_timeout attribute.
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 9c7dd1b9b3..293e559acf 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -158,7 +158,7 @@ class Resolv
##
# Indicates a timeout resolving a name or address.
- class ResolvTimeout < TimeoutError; end
+ class ResolvTimeout < Timeout::Error; end
##
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index 4dfaee99af..6aa2d1c1f2 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -521,7 +521,7 @@ module WEBrick
}
rescue Errno::ECONNRESET
return nil
- rescue TimeoutError
+ rescue Timeout::Error
raise HTTPStatus::RequestTimeout
end
end
diff --git a/sample/timeout.rb b/sample/timeout.rb
index 2870ddb239..8d25d72a76 100644
--- a/sample/timeout.rb
+++ b/sample/timeout.rb
@@ -8,7 +8,7 @@ end
p timeout(5) {
45
}
-p timeout(5, TimeoutError) {
+p timeout(5, Timeout::Error) {
45
}
p timeout(nil) {
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index 4f12db5003..da44a96baa 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -190,10 +190,10 @@ module DRbCore
def test_06_timeout
ten = Onecky.new(10)
- assert_raise(TimeoutError) do
+ assert_raise(Timeout::Error) do
@there.do_timeout(ten)
end
- assert_raise(TimeoutError) do
+ assert_raise(Timeout::Error) do
@there.do_timeout(ten)
end
end
diff --git a/test/ruby/test_readpartial.rb b/test/ruby/test_readpartial.rb
index b969c38692..7f2ec65ac7 100644
--- a/test/ruby/test_readpartial.rb
+++ b/test/ruby/test_readpartial.rb
@@ -50,7 +50,7 @@ class TestReadPartial < Test::Unit::TestCase
w << 'abc'
assert_equal('ab', r.readpartial(2))
assert_equal('c', r.readpartial(2))
- assert_raise(TimeoutError) {
+ assert_raise(Timeout::Error) {
timeout(0.1) { r.readpartial(2) }
}
}
@@ -64,7 +64,7 @@ class TestReadPartial < Test::Unit::TestCase
assert_equal("de", r.readpartial(2))
assert_equal("f\n", r.readpartial(4096))
assert_equal("ghi\n", r.readpartial(4096))
- assert_raise(TimeoutError) {
+ assert_raise(Timeout::Error) {
timeout(0.1) { r.readpartial(2) }
}
}
diff --git a/test/thread/test_queue.rb b/test/thread/test_queue.rb
index 6a3397734a..4f495ccb8c 100644
--- a/test/thread/test_queue.rb
+++ b/test/thread/test_queue.rb
@@ -239,7 +239,7 @@ class TestQueue < Test::Unit::TestCase
th1.raise
sleep 0.1
q << :s
- assert_nothing_raised(TimeoutError) do
+ assert_nothing_raised(Timeout::Error) do
timeout(1) { th2.join }
end
ensure
diff --git a/thread.c b/thread.c
index 4365c1fa6d..aedd0c1e0e 100644
--- a/thread.c
+++ b/thread.c
@@ -1731,29 +1731,29 @@ handle_interrupt_arg_check_i(VALUE key, VALUE val)
* resource allocation code. Then, the ensure block is where we can safely
* deallocate your resources.
*
- * ==== Guarding from TimeoutError
+ * ==== Guarding from Timeout::Error
*
- * In the next example, we will guard from the TimeoutError exception. This
- * will help prevent from leaking resources when TimeoutError exceptions occur
+ * In the next example, we will guard from the Timeout::Error exception. This
+ * will help prevent from leaking resources when Timeout::Error exceptions occur
* during normal ensure clause. For this example we use the help of the
* standard library Timeout, from lib/timeout.rb
*
* require 'timeout'
- * Thread.handle_interrupt(TimeoutError => :never) {
+ * Thread.handle_interrupt(Timeout::Error => :never) {
* timeout(10){
- * # TimeoutError doesn't occur here
- * Thread.handle_interrupt(TimeoutError => :on_blocking) {
- * # possible to be killed by TimeoutError
+ * # Timeout::Error doesn't occur here
+ * Thread.handle_interrupt(Timeout::Error => :on_blocking) {
+ * # possible to be killed by Timeout::Error
* # while blocking operation
* }
- * # TimeoutError doesn't occur here
+ * # Timeout::Error doesn't occur here
* }
* }
*
- * In the first part of the +timeout+ block, we can rely on TimeoutError being
- * ignored. Then in the <code>TimeoutError => :on_blocking</code> block, any
+ * In the first part of the +timeout+ block, we can rely on Timeout::Error being
+ * ignored. Then in the <code>Timeout::Error => :on_blocking</code> block, any
* operation that will block the calling thread is susceptible to a
- * TimeoutError exception being raised.
+ * Timeout::Error exception being raised.
*
* ==== Stack control settings
*