Project

General

Profile

Actions

Bug #3351

closed

stack overflow on super

Added by serge_balyuk (Serge Balyuk) about 12 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-05-26 trunk 28028) [i686-linux]
Backport:
[ruby-core:30450]

Description

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.


Files

super.rb (217 Bytes) super.rb serge_balyuk (Serge Balyuk), 05/27/2010 03:45 PM

Related issues 3 (0 open3 closed)

Related to Ruby master - Bug #2502: strange behavior of anonymous class inside a procClosedko1 (Koichi Sasada)12/19/2009Actions
Related to Ruby master - Bug #5236: Including a module in a superclass after it has been included in a subclass leads to infinite recursion if the module uses `super`Closednobu (Nobuyoshi Nakada)08/27/2011Actions
Related to Ruby master - Feature #1586: Including a module already present in ancestors should not be ignoredRejectedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF