From: "marcandre (Marc-Andre Lafortune)" Date: 2013-03-28T23:01:09+09:00 Subject: [ruby-core:53802] [ruby-trunk - Bug #8166] Since r39628 rspec-mock's and_call_original fail with SystemStackError Issue #8166 has been updated by marcandre (Marc-Andre Lafortune). Hi, nagachika (Tomoyuki Chikanaga) wrote: > I think hiding singleton class from ancestors is better even when a modules is pretended. Do you believe that only because you want to avoid all compatibility issues, or are there other reasons? I believe it should be easy to fix the incompatibility of RSpec, for example by going through ancestors and skipping them until you encounter overriden_method.owner. It might even be easier if there was a builtin way to access `super` as suggested by John Mair [ruby-core:52266, no actual feature request]. I still believe that not hiding the singleton class is both the most consistent and the most helpful. With the advent of `prepend`, it makes even less sense to hide the singleton class. Remember that this question arise only if you access the ancestors from the singleton class. I think it is fair to assume that one understands the existence of singleton classes in this case... I would guess that only fairly advanced libraries (e.g. rspec) would do so and they should be able to adapt easily. I'm not familiar with rspec's code, but I'll have a look later today. Ultimately, this will be Matz' decision. ---------------------------------------- Bug #8166: Since r39628 rspec-mock's and_call_original fail with SystemStackError https://bugs.ruby-lang.org/issues/8166#change-38001 Author: nagachika (Tomoyuki Chikanaga) Status: Open Priority: Normal Assignee: marcandre (Marc-Andre Lafortune) Category: core Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-03-24 trunk 39908) [x86_64-darwin10.8.0] Hello, By r39628 [Feature 8035], Module#ancestors for a singleton class contains singleton class itself. It introduce a compatibility problem with rspec-mock's RSpec::Mocks::MessageExpectation#and_call_original. and_call_original uses Module#ancestors to find the original method overridden by a singleton method. Because ancestors contains singleton class itself, `original_method' return stub method and fall into infinite recursive call. I think hiding singleton class from ancestors is better even when a modules is pretended. -- http://bugs.ruby-lang.org/