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

ruby-changes:33671

From: usa <ko1@a...>
Date: Wed, 30 Apr 2014 16:34:36 +0900 (JST)
Subject: [ruby-changes:33671] usa:r45752 (ruby_2_0_0): merge revision(s) 45364, 45395, 45396, 45403, 45406: [Backport #9652]

usa	2014-04-30 16:34:23 +0900 (Wed, 30 Apr 2014)

  New Revision: 45752

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

  Log:
    merge revision(s) 45364,45395,45396,45403,45406: [Backport #9652]
    
    * time.c (time_mload): freeze and preserve marshal-loaded time zone
    
    * test/ruby/test_time.rb: add test for GC on loaded object
      [Bug #9652]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_time.rb
    branches/ruby_2_0_0/time.c
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/time.c
===================================================================
--- ruby_2_0_0/time.c	(revision 45751)
+++ ruby_2_0_0/time.c	(revision 45752)
@@ -4887,7 +4887,9 @@ end_submicro: ; https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/time.c#L4887
 	time_fixoff(time);
     }
     if (!NIL_P(zone)) {
+	zone = rb_str_new_frozen(zone);
 	tobj->vtm.zone = RSTRING_PTR(zone);
+	rb_ivar_set(time, id_zone, zone);
     }
 
     return time;
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45751)
+++ ruby_2_0_0/ChangeLog	(revision 45752)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Wed Apr 30 16:33:57 2014  Eric Wong  <e@8...>
+
+	* time.c (time_mload): freeze and preserve marshal-loaded time zone
+	* test/ruby/test_time.rb: add test for GC on loaded object
+	  [Bug #9652]
+
 Wed Apr 30 16:15:09 2014  Kohei Suzuki  <eagletmt@g...>
 
 	* vm_method.c (rb_method_entry_get_without_cache): me->klass is 0
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 45751)
+++ ruby_2_0_0/version.h	(revision 45752)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-04-30"
-#define RUBY_PATCHLEVEL 472
+#define RUBY_PATCHLEVEL 473
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_0_0/test/ruby/test_time.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_time.rb	(revision 45751)
+++ ruby_2_0_0/test/ruby/test_time.rb	(revision 45752)
@@ -311,6 +311,21 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_time.rb#L311
     end
   end
 
+  def test_marshal_zone_gc
+    assert_separately(%w(--disable-gems), <<-'end;', timeout: 30)
+      ENV["TZ"] = "JST-9"
+      s = Marshal.dump(Time.now)
+      t = Marshal.load(s)
+      n = 0
+      done = 100000
+      while t.zone.dup == "JST" && n < done
+        n += 1
+      end
+      assert_equal done, n, "Bug #9652"
+      assert_equal "JST", t.zone, "Bug #9652"
+    end;
+  end
+
   def test_marshal_to_s
     t1 = Time.new(2011,11,8, 0,42,25, 9*3600)
     t2 = Time.at(Marshal.load(Marshal.dump(t1)))

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45364,45395-45396,45403,45406


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

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