Project

General

Profile

Actions

Bug #3422

closed

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

Added by judofyr (Magnus Holm) over 14 years ago. Updated almost 12 years ago.

Status:
Closed
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 3 (0 open3 closed)

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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0