diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-31 09:46:31 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-31 09:46:31 +0000 |
commit | a34130eb7c4ecc164115a59aa1b76c643bd98202 (patch) | |
tree | d388ef4d997856df8f53aa8008e6e01622fc6228 /array.c | |
parent | 03b4ecf86da934e4018bc9b4e91653c046644911 (diff) | |
download | ruby-a34130eb7c4ecc164115a59aa1b76c643bd98202.tar.gz ruby-a34130eb7c4ecc164115a59aa1b76c643bd98202.tar.xz ruby-a34130eb7c4ecc164115a59aa1b76c643bd98202.zip |
* array.c (ary_partial0): recovers mistakenly feature change at r19723.
Array#[m,n] had returned an Array even for an instance of a
subclass.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -610,7 +610,10 @@ ary_make_partial0(VALUE ary, long offset, long len) assert(offset+len <= RARRAY_LEN(ary)); if (len <= RARRAY_EMBED_LEN_MAX) { - return rb_ary_new4(len, RARRAY_PTR(ary) + offset); + VALUE result = ary_alloc(rb_obj_class(ary)); + MEMCPY(ARY_EMBED_PTR(result), RARRAY_PTR(ary) + offset, VALUE, len); + ARY_SET_EMBED_LEN(result, len); + return result; } else { VALUE shared, result = ary_alloc(rb_obj_class(ary)); |