Project

General

Profile

Actions

Bug #6863

closed

Class#initialize infinite loops when passed self

Added by Anonymous over 12 years ago. Updated over 12 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.0.0dev
Backport:
[ruby-core:47148]

Description

=begin
The following code sends Ruby into an infinite loop:

x = Class.allocate
x.send :initialize, x

The problem appears to be in rb_class_initialize (object.c:1564) when Ruby attempts to call (({#inherited})) on the newly created class. The method lookup infinite loops as it tries to descend the ancestor chain.

This should probably throw a (({TypeError})) instead.
=end


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0