Backport #2568

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

Added by kch (Caio Chassot) over 10 years ago. Updated about 1 year ago.



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

class BugHash < Hash
define_method(:delete) { |*a| super *a }
end :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'
block in class:BugHash'
bughash.rb:7:in `'

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

You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details:

Abort trap

Related issues

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

Updated by wanabe (_ wanabe) over 10 years ago

backporting r26283 will fix this issue, I guess.


Updated by nobu (Nobuyoshi Nakada) over 10 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to yugui (Yuki Sonoda)




Updated by jeremyevans0 (Jeremy Evans) about 1 year ago

  • Status changed from Assigned to Closed
  • Description updated (diff)

Also available in: Atom PDF