Project

General

Profile

Actions

Bug #3423

closed

Inconsistent behaviour of Module#const_get with included modules

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

Status:
Closed
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 2 (0 open2 closed)

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
Actions #1

Updated by yugui (Yuki Sonoda) over 14 years ago

  • Target version set to 1.9.2

=begin

=end

Updated by naruse (Yui NARUSE) over 13 years ago

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

Updated by nahi (Hiroshi Nakamura) over 13 years ago

  • Target version changed from 1.9.2 to 1.9.3
Actions #4

Updated by matz (Yukihiro Matsumoto) over 13 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0