From: "byroot (Jean Boussier) via ruby-core" Date: 2025-05-14T14:20:57+00:00 Subject: [ruby-core:122098] [Ruby Bug#21339] Namespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace Issue #21339 has been reported by byroot (Jean Boussier). ---------------------------------------- Bug #21339: Namespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace https://bugs.ruby-lang.org/issues/21339 * Author: byroot (Jean Boussier) * Status: Assigned * Assignee: tagomoris (Satoshi Tagomori) * ruby -v: ruby 3.5.0dev (2025-05-14T12:41:46Z master b5575a80bc) +PRISM [arm64-darwin24] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- ```ruby 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: ```bash main: [:compile_cache_setup] [:load_iseq, "/tmp/test-file.rb"] ``` ```bash main: [:compile_cache_setup] namespace: [:compile_cache_setup] [:load_iseq, "/tmp/test-file.rb"] ``` But I don't understand why. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/