Project

General

Profile

Actions

Bug #21265

closed

Crash when proc from Symbol#to_proc called outside refinement scope

Bug #21265: Crash when proc from Symbol#to_proc called outside refinement scope

Added by alanwu (Alan Wu) 8 months ago. Updated 4 days ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.2 and trunk
[ruby-core:121629]

Description

class RefinedScope
  using(Module.new { refine(Kernel) { def itself = 0 } })
  ITSELF = :itself.to_proc
end

RefinedScope::ITSELF[0]
../vm_method.c:1371: Assertion Failed: prepare_callable_method_entry:RB_TYPE_2_P(defined_class, RUBY_T_ICLASS, RUBY_T_MODULE): defined_class: T_FALSE

Or SEGV without -DRUBY_DEBUG.

Updated by alanwu (Alan Wu) about 1 month ago Actions #1

  • Status changed from Open to Closed

Applied in changeset git|6e6f5d3c32a709c891ac6aa7833376907a6c81b5.


Add test for [Bug #21265]

The crash was fixed by a4dff09be79b52288a47658964d25e5aa84fc960 ("Fix
resolving refined module-defined method"). I had a patch for this around
for a few months but never merged it. Oops!

Updated by k0kubun (Takashi Kokubun) 4 days ago Actions #2 [ruby-core:124059]

  • Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE
Actions

Also available in: PDF Atom