Project

General

Profile

Actions

Backport #2568

closed

Segmentation fault deleting key named :class via Hash#delete defined via define_method

Added by kch (Caio Chassot) almost 15 years ago. Updated over 5 years ago.

Status:
Closed
[ruby-core:27460]

Description

=begin
$ cat bughash.rb
#!/usr/bin/env ruby1.9

class BugHash < Hash
define_method(:delete) { |*a| super *a }
end

BugHash.new.delete :class

$ ruby1.9 bughash.rb
bughash.rb:4: [BUG] Segmentation fault
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10]

-- control frame ----------
c:0006 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :delete
c:0005 p:0011 s:0011 b:0011 l:0022c8 d:000010 LAMBDA bughash.rb:4
c:0004 p:---- s:0008 b:0008 l:000007 d:000007 FINISH
c:0003 p:0039 s:0006 b:0006 l:001a68 d:000c88 EVAL bughash.rb:7
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a68 d:001a68 TOP

-- Ruby level backtrace information-----------------------------------------
bughash.rb:4:in delete' bughash.rb:4:in block in class:BugHash'
bughash.rb:7:in `'

-- C level backtrace information -------------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #2583: クラス定義中の defined? yield が "yield" を返すClosedko1 (Koichi Sasada)01/10/2010Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0