Project

General

Profile

Actions

Bug #21339

open

Namespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace

Bug #21339: Namespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace

Added by byroot (Jean Boussier) 6 months ago. Updated 6 months ago.

Status:
Assigned
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-05-14T12:41:46Z master b5575a80bc) +PRISM [arm64-darwin24]
[ruby-core:122098]

Description

File.write("/tmp/compile-cache.rb", <<~'RUBY') class << RubyVM::InstructionSequence def load_iseq(path) p [:load_iseq, path] RubyVM::InstructionSequence.compile_file(path) end end RUBY File.write("/tmp/test-file.rb", "") puts "main:" require "/tmp/compile-cache.rb" require "/tmp/test-file.rb" if ENV["RUBY_NAMESPACE"] puts "namespace:" ns = Namespace.new ns.require("/tmp/compile-cache.rb") ns.require("/tmp/test-file.rb") end 

Expected behavior:

I would expect load_iseq to be invoked both in the root namespace and the user namespace when RUBY_NAMESPACE=1.

Actual behavior:

Somehow it's only invoked in the user namespace:

main: [:compile_cache_setup] [:load_iseq, "/tmp/test-file.rb"] 
main: [:compile_cache_setup] namespace: [:compile_cache_setup] [:load_iseq, "/tmp/test-file.rb"] 

But I don't understand why.


Related issues 1 (1 open0 closed)

Actions

Also available in: PDF Atom