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) 7 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) 4 days 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!

Actions

Also available in: PDF Atom