Project

General

Profile

Actions

Bug #11046

closed

__callee__ returns incorrect method name in orphan proc

Added by ko1 (Koichi Sasada) about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-04-07 trunk 50171) [i386-mswin32_110]
[ruby-core:<unknown>]

Description

callee returns incorrect method name in orphan proc.

def foo
  1.times{
    p __callee__
  }
  proc{
    __callee__
  }
end

alias bar foo

pr = bar #=> :bar
GC.start
p pr.call #=> :foo

Reproduce on 2.0 to 2.3dev.

Actions #1

Updated by ko1 (Koichi Sasada) almost 9 years ago

  • Status changed from Open to Closed

Applied in changeset r50728.


  • method.h: make rb_method_entry_t a VALUE.
    Motivation and new data structure are described in [Bug #11203].
    This patch also solve the following issues.
    • [Bug #11200] Memory leak of method entries
    • [Bug #11046] callee returns incorrect method name in orphan
      proc
  • test/ruby/test_method.rb: add a test for [Bug #11046].
  • vm_core.h: remvoe rb_control_frame_t::me. me is located at value
    stack.
  • vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes
    because method entries are simple VALUEs.
  • method.h: Now, all method entries has own independent method
    definititons. Strictly speaking, this change is not essential,
    but for future changes.
    • rb_method_entry_t::flag is move to rb_method_definition_t::flag.
    • rb_method_definition_t::alias_count is now
      rb_method_definition_t::alias_count_ptr, a pointer to the counter.
  • vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to
    search the current method entry from value stack.
  • vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable
    assertions.

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED
Actions

Also available in: Atom PDF

Like0
Like0Like0