mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071] * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass): added a new test for eigenclass of time object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4b29cccf57
commit
6270ce85ed
3 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
Sat Jul 16 00:55:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
|
||||
The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071]
|
||||
|
||||
* test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass):
|
||||
added a new test for eigenclass of time object.
|
||||
|
||||
Fri Jul 15 19:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
||||
|
||||
* bignum.c (bigsub_int): add RB_GC_GUARD. This patch is made by
|
||||
|
|
|
@ -697,4 +697,18 @@ class TestTime < Test::Unit::TestCase
|
|||
off += 0.1
|
||||
}
|
||||
end
|
||||
|
||||
def test_getlocal_dont_share_eigenclass
|
||||
bug5012 = "[ruby-dev:44071]"
|
||||
|
||||
t0 = Time.now
|
||||
class <<t0; end
|
||||
t1 = t0.getlocal
|
||||
|
||||
def t0.m
|
||||
0
|
||||
end
|
||||
|
||||
assert_raise(NoMethodError, bug5012) { t1.m }
|
||||
end
|
||||
end
|
||||
|
|
2
time.c
2
time.c
|
@ -3430,7 +3430,7 @@ time_init_copy(VALUE copy, VALUE time)
|
|||
static VALUE
|
||||
time_dup(VALUE time)
|
||||
{
|
||||
VALUE dup = time_s_alloc(CLASS_OF(time));
|
||||
VALUE dup = time_s_alloc(rb_obj_class(time));
|
||||
time_init_copy(dup, time);
|
||||
return dup;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue