Bug #3080

class_variable_set issue with duped Module

Added by Evgeniy Dolzhenko about 4 years ago. Updated over 1 year ago.

[ruby-core:29228]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
Category:-
Target version:2.0.0
ruby -v:ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux] Backport:

Description

=begin
Below is the test case which is failing for me on ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux] but works on ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]:


module Original
@@cvar = nil

def self.modulegetcvar
@@cvar
end

def functiongetcvar
@@cvar
end
end

Duped = Original.dup

Original.send(:classvariableset, :@@cvar, "cvar in Original")
Duped.send(:classvariableset, :@@cvar, "cvar in Duped")

class IncludesOriginal
include Original
end

class IncludesDuped
include Duped
end

puts IncludesOriginal.new.functiongetcvar # => cvar in Original
puts IncludesDuped.new.functiongetcvar # => cvar in Duped

puts Original.modulegetcvar # => cvar in Original

puts Duped.modulegetcvar # => 19dupedmoduleclassvariablesetbug.rb:3: warning: class variable access from toplevel
# 19dupedmoduleclassvariablesetbug.rb:3:in get_cvar': uninitialized class variable @@cvar in Object (NameError)
# from 19_duped_module_class_variable_set_bug.rb:13:in
'


=end


Related issues

Related to ruby-trunk - Bug #3136: reuse of singleton method definition causes SEGV Closed 04/12/2010

History

#1 Updated by Yusuke Endoh almost 4 years ago

  • Target version set to 2.0.0

=begin
Hi,

This is similar issue to .
This issue is caused by ISeq#cref_stack instead of ISeq#klass.
This won't be fixed in 1.9.2.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#2 Updated by Yui NARUSE almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Koichi Sasada
  • Target version changed from 2.0.0 to 1.9.3

#3 Updated by Koichi Sasada almost 3 years ago

  • Target version changed from 1.9.3 to 2.0.0

Let's discuss after 1.9.3. Sorry.

#4 Updated by Koichi Sasada over 1 year ago

  • Assignee changed from Koichi Sasada to Nobuyoshi Nakada

nobu, could you check it?

#5 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF