Forum: Ruby-core [Closed] Object.const_get(:A, false) can access BasicObject::A

02da662c083396641da96c1d32fc86ed?d=identicon&s=25 kosaki (Motohiro KOSAKI) (Guest)
on 2013-01-10 01:37
(Received via mailing list)
Issue #3422 has been updated by kosaki (Motohiro KOSAKI).

Status changed from Assigned to Closed

> Kosaki-san, why did you reopen this ticket?

Sorry, my memory was lost and I don't remember why. but I suspect your
guess is right and we can close this ticket.

Bug #3422: Object.const_get(:A, false) can access BasicObject::A

Author: judofyr (Magnus Holm)
Status: Closed
Priority: Normal
Assignee: kosaki (Motohiro KOSAKI)
Category: core
Target version: 2.0.0
ruby -v: -

 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
This topic is locked and can not be replied to.