mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) r45364,r45395,r45396,r45403,r45406: [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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
52950d94d1
commit
282462b206
4 changed files with 24 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Jun 2 02:12:10 2014 Eric Wong <e@80x24.org>
|
||||
|
||||
* 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]
|
||||
|
||||
Mon Jun 2 01:57:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an
|
||||
|
|
|
@ -311,6 +311,21 @@ class TestTime < Test::Unit::TestCase
|
|||
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)))
|
||||
|
|
2
time.c
2
time.c
|
@ -4805,7 +4805,9 @@ end_submicro: ;
|
|||
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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.1.2"
|
||||
#define RUBY_RELEASE_DATE "2014-06-02"
|
||||
#define RUBY_PATCHLEVEL 120
|
||||
#define RUBY_PATCHLEVEL 121
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2014
|
||||
#define RUBY_RELEASE_MONTH 6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue