aboutsummaryrefslogtreecommitdiffstats
path: root/enum.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-12 13:24:53 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-12 13:24:53 +0000
commit7ea98b5db67d6378eb430ea98438424688a7db09 (patch)
tree708435a679e1c6ba9bffa93b213f7035457d2f08 /enum.c
parentb485a939bacd4c7db0e4094dbe3d3c1bbac44b87 (diff)
downloadruby-7ea98b5db67d6378eb430ea98438424688a7db09.tar.gz
* enum.c (enum_to_a): fix incompatibility introduced in r50457.
[Bug #11130] * test/ruby/test_enum.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/enum.c b/enum.c
index ea151b464d..2516934814 100644
--- a/enum.c
+++ b/enum.c
@@ -517,11 +517,11 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
{
VALUE ary, size = rb_check_funcall(obj, id_size, 0, 0);
- if (NIL_P(size) || size == Qundef) {
- ary = rb_ary_new();
+ if (FIXNUM_P(size)) {
+ ary = rb_ary_new_capa(NUM2LONG(size));
}
else {
- ary = rb_ary_new_capa(NUM2LONG(size));
+ ary = rb_ary_new();
}
rb_block_call(obj, id_each, argc, argv, collect_all, ary);