Project

General

Profile

Actions

Bug #21318

closed

Namespaces leak with Module.nesting

Bug #21318: Namespaces leak with Module.nesting

Added by fxn (Xavier Noria) 7 months ago. Updated 8 days ago.

Status:
Closed
Target version:
-
[ruby-core:121952]
Tags:

Description

Namespaces are not transparent for this program:

Module.nesting

The nesting is empty or not depending on whether it is being executed under a namespace.

Updated by fxn (Xavier Noria) 7 months ago ยท Edited Actions #1 [ruby-core:121953]

  • Subject changed from Namespaces leak with permanent names to Namespaces leak with Module.nesting

Updated by Eregon (Benoit Daloze) 7 months ago Actions #2 [ruby-core:121980]

Complete reproducer:

$ RUBY_NAMESPACE=1 ruby -ve 'p Module.nesting; ns = Namespace.new; File.write "ns.rb", "p Module.nesting"; ns.require "./ns"'
ruby 3.5.0dev (2025-05-10T07:50:29Z namespace-on-read-.. bd4f57f96b) +PRISM [x86_64-linux]
ruby: warning: Namespace is experimental, and the behavior may change in the future!
See doc/namespace.md for know issues, etc.
[]
[#<Namespace:24,user,optional>]

Updated by hsbt (Hiroshi SHIBATA) 7 months ago Actions #3

  • Tags set to namespace

Updated by tagomoris (Satoshi Tagomori) 8 days ago Actions #4 [ruby-core:124089]

  • Assignee set to tagomoris (Satoshi Tagomori)

Updated by tagomoris (Satoshi Tagomori) 8 days ago Actions #5 [ruby-core:124099]

  • Status changed from Open to Closed

Now Module.nesting doesn't return its box information in a box.

MBA:build s-tagomori$ RUBY_BOX=1 ./exe/ruby -v
ruby 4.0.0dev (2025-12-09T12:29:36Z box-news-documents.. c998717de8) +PRISM [arm64-darwin24]
MBA:build s-tagomori$ RUBY_BOX=1 ./exe/ruby -ve 'p Module.nesting; ns = Ruby::Box.new; File.write "ns.rb", "p Module.nesting"; ns.require "./ns"'
ruby 4.0.0dev (2025-12-09T12:29:36Z box-news-documents.. c998717de8) +PRISM [arm64-darwin24]
./exe/ruby: warning: Ruby::Box is experimental, and the behavior may change in the future!
See doc/language/box.md for known issues, etc.
[]
[]
MBA:build s-tagomori$ 
Actions

Also available in: PDF Atom