Bug #9354
closedtimeout() custom exception class cannot require argument
Description
The following code works on 2.0.0, but raises on 2.1.0:
require 'timeout'
class MyError < StandardError
def initialize(msg)
super
end
end
timeout(1, MyError){}
$ ruby -v
ruby 2.1.0p0-github (2013-12-31 revision 44488) [x86_64-darwin13.0]
$ ruby /tmp/test.rb
/tmp/test.rb:4:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
The patch attached resolves this issue.
Files
Updated by tmm1 (Aman Karmani) almost 11 years ago
- File timeout_klass_arg.patch timeout_klass_arg.patch added
Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r44517.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
timeout.rb: defer creating custom exception
- lib/timeout.rb (Timeout#timeout): when a custom exception is given,
no instance is needed to be caught, so defer creating new instance
until it is raised. [ruby-core:59511] [Bug #9354]
Updated by tmm1 (Aman Karmani) almost 11 years ago
- Assignee set to naruse (Yui NARUSE)
- Target version set to 2.6
- % Done changed from 100 to 0
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: REQUIRED
Thanks @nobu (Nobuyoshi Nakada). This is causing some failures in the faraday gem, so I think we should backport it to 2.1
Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
- Status changed from Closed to Open
- Assignee deleted (
naruse (Yui NARUSE)) - Target version deleted (
2.6) - Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED
Timeout in 2.0 doesn't use catch/throw, so it doesn't need to backport.
Updated by nobu (Nobuyoshi Nakada) almost 11 years ago
- Category set to lib
- Assignee set to naruse (Yui NARUSE)
- Target version set to 2.6
Updated by naruse (Yui NARUSE) almost 11 years ago
- Status changed from Open to Closed
Updated by naruse (Yui NARUSE) almost 11 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE
ruby_2_1 r44841 merged revision(s) 44517,44518,44519,44523.