Issue #3422 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Closed to Open


----------------------------------------
Bug #3422: Object.const_get(:A, false) can access BasicObject::A
https://bugs.ruby-lang.org/issues/3422#change-31475

Author: judofyr (Magnus Holm)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 1.9.3
ruby -v: -


=begin
 From the documentation of Module#const_get(sym, inherit=true):
 
   If the constant is not defined or is defined by the ancestors and inherit is false, NameError will be raised.
 
 Yet, this works fine:
 
   BasicObject::A = 1
   Object.const_get(:A, false) # => 1
 
 While I haven't tested it, I believe the attached patch should fix the issue.
=end



-- 
http://bugs.ruby-lang.org/