Christian Neukirchen <chneukirchen / gmail.com> wrote:
> Caleb Clausen <vikkous / gmail.com> writes:
>
>> 100_000.times{|n|
>>   o=Object.new;
>>   i=o.__id__;
>>   o2=ObjectSpace._id2ref(i);
>>   o.equal? o2 or raise "o=#{o}, i=#{"%x"%i}, o2=#{o2.inspect},
>> n=#{n}" }
>>
>> The exception should never be raised. On my OS X 10.3.9 system (and
>> at least 1 other) it does get eventually raised after a few hundred
>> iterations using ruby 1.8 and 1.9. With the (apple-supplied) ruby
>> 1.6, it does not happen. Tests on several Windows and Linux systems
>> have never observed a problem, using ruby 1.8 and 1.9. I don't know
>> if it's a problem on OS X 10.4; I don't have access to any 10.4
>> systems.
>>
>> The problem seems to be in the call to __id__. Usually, it works
>> correctly, but every once in a while it returns the id of some random
>> symbol. Does anyone know why this is happening?
>
> I can reproduce on ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]:
>
> o=#<Object:0x1d421c>, i=ea10e, o2=:reject, n=448 (RuntimeError)
>
> It looks like the object id wrapped in some way and now points to a
> symbol?  Clearly looks like a bug.

Wow!  Does it exhibit the same behavior with #object_id instead of #__id__? 
Guess so...  Now we just have to figure whether the bug is in #__id__ or 
_id2ref.  Somehow I suspect it's the former...

    robert