From 44c8d6c4dbc75555ab2993ca1b39c42771313437 Mon Sep 17 00:00:00 2001 From: wyhaines Date: Tue, 8 Jun 2010 16:54:21 +0000 Subject: lib/date.rb: Backport #2707 [ruby-core:28011]; backport r27014 to fix problem with Date#>> and very small numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 ++++++--- lib/date.rb | 6 +++++- version.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f4a1ea319..46e1b69454 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ -Wed June 9 01:05:00 Kirk Haines +Wed Jun 9 01:42:00 Kirk Haines - * lib/monitor.rb: Backport #2240 [ruby-core:26185]; backport r25420 to ensure that the scheduled thread is alive when a monitor is released. - * test/monitor/test_monitor.rb: Backport #2240 [ruby-core:26185]; added a test for the above functionality. + * lib/date.rb: Backport #2707 [ruby-core:28011]; backport r27014 to fix problem with Date#>> and very small numbers. +Wed Jun 9 01:05:00 Kirk Haines + + * lib/monitor.rb: Backport #2240 [ruby-core:26185]; backport r25420 to ensure that the scheduled thread is alive when a monitor is released. r28232 + * test/monitor/test_monitor.rb: Backport #2240 [ruby-core:26185]; added a test for the above functionality. r28232 Tue Jun 8 23:45:00 2010 Kirk Haines diff --git a/lib/date.rb b/lib/date.rb index ea557313f7..d562fd12b1 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -1273,7 +1273,11 @@ class Date y, m = (year * 12 + (mon - 1) + n).divmod(12) m, = (m + 1) .divmod(1) d = mday - d -= 1 until jd2 = self.class.valid_civil?(y, m, d, fix_style) + until jd2 = self.class.valid_civil?(y, m, d, fix_style) + d -= 1 + raise ArgumentError, 'invalid date' unless d > 0 + end + self + (jd2 - jd) end diff --git a/version.h b/version.h index 17d77ddd83..895312bebf 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-09" #define RUBY_VERSION_CODE 186 #define RUBY_RELEASE_CODE 20100609 -#define RUBY_PATCHLEVEL 408 +#define RUBY_PATCHLEVEL 409 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3