Forum: Ruby-core stack overflow on super

C4e88907313843cf07f6d85ba8162120?d=identicon&s=25 shugo (Shugo Maeda) (Guest)
on 2012-12-13 06:24
(Received via mailing list)
Issue #3351 has been updated by shugo (Shugo Maeda).

Assignee changed from shugo (Shugo Maeda) to matz (Yukihiro Matsumoto)

mame (Yusuke Endoh) wrote:
> Shugo-san, ko1, what's the status?

Override#foo is called only once, because in the SVN trunk, if a method
found by super is the current method, it's skipped to avoid an infinite
loop.  The check was introduced for super in a refinement.  Without it,
super in a refinement causes an infinite loop.

> Do you think this issue important?

I don't think so.  Can I leave it as is, Matz?

----------------------------------------
Bug #3351: stack overflow on super
https://bugs.ruby-lang.org/issues/3351#change-34690

Author: serge_balyuk (Serge Balyuk)
Status: Assigned
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0
ruby -v: ruby 1.9.3dev (2010-05-26 trunk 28028) [i686-linux]


=begin
 It looks like `super` behavior is a bit different in 1.8 and 1.9.
Please find the example below:

 class Base
   def foo
     puts "bar"
   end
 end

 module Override
   def foo
     puts "override"
     super
   end
 end


 class A < Base
 end

 class B < A
 end

 B.send(:include, Override)
 A.send(:include, Override)

 B.new.foo

 ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] output:


 override
 override
 bar


 and ruby 1.9.3dev (2010-05-26 trunk 28028) [i686-linux] output:

 ....
 override
 override
 override
 override
 override
 super.rb:9: stack level too deep (SystemStackError)


 Hope that helps.
=end
6738588a11b852833edf6aec90ef6fa3?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2012-12-13 06:34
(Received via mailing list)
Hi,

In message "Re: [ruby-core:50857] [ruby-trunk - Bug #3351] stack
overflow on super"
    on Thu, 13 Dec 2012 14:24:21 +0900, "shugo (Shugo Maeda)"
<redmine@ruby-lang.org> writes:

|> Do you think this issue important?
|
|I don't think so.  Can I leave it as is, Matz?

OK.

              matz.
This topic is locked and can not be replied to.