Project

General

Profile

Bug #3423

Inconsistent behaviour of Module#const_get with included modules

Added by judofyr (Magnus Holm) over 9 years ago. Updated about 8 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::AClosed06/11/2010Actions

Associated revisions

Revision e6540a03
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 32283
Added by matz (Yukihiro Matsumoto) about 8 years ago

  • 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]

Revision 5700a860
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 32327
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

Revision 5f1eb218
Added by yugui (Yuki Sonoda) about 8 years ago

merges r32283 from trunk into ruby_1_9_2.

  • 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 31a5ce34
Added by yugui (Yuki Sonoda) about 8 years ago

merges r32327 from trunk into ruby_1_9_2.

  • test/ruby/test_module.rb: tests for [Bug #3422] and [Bug #3423].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 43284b6b
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 0f0db416
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

Revision 33157
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see also inherited constants for classes without superclass and modules. [ruby-core:37698] [Bug #3423]

History

#1

Updated by yugui (Yuki Sonoda) about 9 years ago

  • Target version set to 1.9.2

=begin

=end

Updated by naruse (Yui NARUSE) about 8 years ago

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

Updated by nahi (Hiroshi Nakamura) about 8 years ago

  • Target version changed from 1.9.2 to 1.9.3
#4

Updated by matz (Yukihiro Matsumoto) about 8 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