diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-03 10:34:45 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-03 10:34:45 +0000 |
commit | cd5679fdc814aa8784c7f8215762331e653284bd (patch) | |
tree | a39843774d43baaf5925b24e094c1bad5daaee67 /enumerator.c | |
parent | 906a942592fd805567920917f7fa75f93fd32301 (diff) | |
download | ruby-cd5679fdc814aa8784c7f8215762331e653284bd.tar.gz ruby-cd5679fdc814aa8784c7f8215762331e653284bd.tar.xz ruby-cd5679fdc814aa8784c7f8215762331e653284bd.zip |
* enumerator.c (enumerator_init_copy): Take care of
initialize_copy as well as initialize.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c index 080151765..13c9bebec 100644 --- a/enumerator.c +++ b/enumerator.c @@ -276,7 +276,12 @@ enumerator_init_copy(VALUE obj, VALUE orig) /* Fibers cannot be copied */ rb_raise(rb_eTypeError, "can't copy execution context"); } - ptr1 = enumerator_ptr(obj); + + Data_Get_Struct(obj, struct enumerator, ptr1); + + if (!ptr1) { + rb_raise(rb_eArgError, "unallocated enumerator"); + } ptr1->obj = ptr0->obj; ptr1->meth = ptr0->meth; |