diff --git a/ChangeLog b/ChangeLog index 18665b95e7..dcb55ae763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jun 14 16:49:41 2008 Nobuyoshi Nakada + + * lib/timeout.rb (Timeout::timeout): made sensitive to location on the + stack. [ruby-core:15458] + Fri Jun 13 13:14:31 2008 Yukihiro Matsumoto * ext/dl/ptr.c (dlmem_each_i): typo fixed. a patch from IKOMA diff --git a/lib/timeout.rb b/lib/timeout.rb index dc92964c0b..5a99c28092 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -32,8 +32,13 @@ module Timeout ## # Raised by Timeout#timeout when the block times out. - class Error e + rej = /\A#{Regexp.quote(__FILE__)}:#{__LINE__-4}\z/o + (bt = e.backtrace).reject! {|m| rej =~ m} + level = -caller(CALLER_OFFSET).size + while THIS_FILE =~ bt[level] + bt.delete_at(level) + level += 1 + end + raise if klass # if exception class is specified, it + # would be expected outside. + raise Error, e.message, e.backtrace ensure y.kill if y and y.alive? end @@ -72,7 +89,7 @@ end # Defined for backwards compatibility with earlier versions of timeout.rb, see # Timeout#timeout. -def timeout(n, e=Timeout::Error, &block) # :nodoc: +def timeout(n, e = nil, &block) # :nodoc: Timeout::timeout(n, e, &block) end diff --git a/version.h b/version.h index 5811945f2a..a93eaa20e4 100644 --- a/version.h +++ b/version.h @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2008-06-13" +#define RUBY_RELEASE_DATE "2008-06-14" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20080613 -#define RUBY_PATCHLEVEL 175 +#define RUBY_RELEASE_CODE 20080614 +#define RUBY_PATCHLEVEL 176 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 13 +#define RUBY_RELEASE_DAY 14 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];