Project

General

Profile

Bug #3422

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

Added by judofyr (Magnus Holm) over 10 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
-
Backport:
[ruby-core:30719]

Description

=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


Files

patch.diff (417 Bytes) patch.diff Patch judofyr (Magnus Holm), 06/11/2010 04:11 AM

Related issues

Is duplicate of Ruby master - Bug #3423: Inconsistent behaviour of Module#const_get with included modulesClosedmatz (Yukihiro Matsumoto)06/11/2010Actions
Has duplicate Ruby master - Bug #5143: include not properly registering modular methodsClosed08/02/2011Actions
Has duplicate Ruby master - Bug #5154: method_missing and module scope, regression in 1.9.3Closedmatz (Yukihiro Matsumoto)08/03/2011Actions

Also available in: Atom PDF