Actions
Bug #6449
closednew does not call allocate, as advertized
    Bug #6449:
    new does not call allocate, as advertized
  
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p217 (2012-05-18 revision 35702) [x86_64-darwin10.8.0]
Backport:
Description
ruby 1.9.3p217 (2012-05-18 revision 35702) [x86_64-darwin10.8.0] (1.8 seems the same)
class C
def self.allocate
Kernel.exit(1)
end
end
C.new # => <C:...
C.allocate # terminates process
Expected C.new call to invoke allocate, see here: https://github.com/ruby/ruby/blob/trunk/object.c#L1697
        
           Updated by shyouhei (Shyouhei Urabe) over 13 years ago
          Updated by shyouhei (Shyouhei Urabe) over 13 years ago
          
          
        
        
      
      - Status changed from Open to Rejected
Yes it does. What's not permitted is to define your allocate method. It is for C extensions only.
        
           Updated by shyouhei (Shyouhei Urabe) over 13 years ago
          Updated by shyouhei (Shyouhei Urabe) over 13 years ago
          
          
        
        
      
      PS if you need something, tell us why you need something.
In this case we prohibit (re)defining allocator beacuse we
believe redefining new should suffice all needs. If you
don't think so, please show the reason.
Actions