From: David Flanagan Date: 2007-10-19T02:05:38+09:00 Subject: Re: enum.c patch: fixes Enumerable.cycle and rdoc bugs Yukihiro Matsumoto wrote: > > |3) The implementation of Enumerable.cycle was subject to the same bug > |that I previous reported for Array.cycle: when called on an empty > |collection, it would spin forever within tight infinite loop, never > |invoking the associated block, and requiring a kill -9 as the only way > |to terminate the process. The patch makes cycle return nil if the > |Enumerable has no elements, and updates the documentation to reflect that. > > RSTRING_LEN() may be modified during the invocation of rb_yield(), so > that storing length in the local variable may not work. But I will > add code to break if the collection is empty. > > matz. I thought that since the internal array was private to the implementation it was safe to only test its length once. Are you concerned about concurrent access to it through ObjectSpace? Or am I missing some other way that it is exposed? David