Project

General

Profile

Bug #3423

Inconsistent behaviour of Module#const_get with included modules

Added by judofyr (Magnus Holm) about 10 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2dev (2010-05-31 revision 28117) [x86_64-darwin10.3.0]
Backport:
[ruby-core:30720]

Description

=begin
module Foo
A = 1
end

class Object
include Foo
end

class Bar
include Foo
end

Object.const_get(:A, false) # => works fine
Bar.const_get(:A, false) # => raises error

Untested patch attached. This might also fix #3422.
=end


Files

yay.diff (389 Bytes) yay.diff judofyr (Magnus Holm), 06/11/2010 04:16 AM

Related issues

Related to Ruby master - Bug #5264: Commit 33157Closed09/02/2011Actions
Has duplicate Ruby master - Bug #3422: Object.const_get(:A, false) can access BasicObject::AClosedkosaki (Motohiro KOSAKI)06/11/2010Actions
#1

Updated by yugui (Yuki Sonoda) about 10 years ago

  • Target version set to 1.9.2

=begin

=end

Updated by naruse (Yui NARUSE) about 9 years ago

  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)

Updated by nahi (Hiroshi Nakamura) about 9 years ago

  • Target version changed from 1.9.2 to 1.9.3
#4

Updated by matz (Yukihiro Matsumoto) about 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r32283.
Magnus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • variable.c (rb_const_get_0): should not look for superclasses if the second optional argument is given for #const_get(). fix [Bug #3422] [Bug #3423]

Also available in: Atom PDF