Project

General

Profile

Backport #2568

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

Added by kch (Caio Chassot) over 9 years ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
[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

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

History

#1

Updated by wanabe (_ wanabe) over 9 years ago

=begin
backporting r26283 will fix this issue, I guess.
=end

#2

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

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

=begin

=end

#3

Updated by jeremyevans0 (Jeremy Evans) 2 months ago

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

Also available in: Atom PDF