Project

General

Profile

Actions

Bug #3080

closed

class_variable_set issue with duped Module

Added by dolzenko (Evgeniy Dolzhenko) over 14 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux]
Backport:
[ruby-core:29228]

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.module_get_cvar
@@cvar
end

def function_get_cvar
@@cvar
end
end

Duped = Original.dup

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

class IncludesOriginal
include Original
end

class IncludesDuped
include Duped
end

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

puts Original.module_get_cvar # => cvar in Original

puts Duped.module_get_cvar # => 19_duped_module_class_variable_set_bug.rb:3: warning: class variable access from toplevel
# 19_duped_module_class_variable_set_bug.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 1 (0 open1 closed)

Related to Ruby master - Bug #3136: reuse of singleton method definition causes SEGVClosedko1 (Koichi Sasada)04/12/2010Actions
Actions #1

Updated by mame (Yusuke Endoh) over 14 years ago

  • Target version set to 2.0.0

=begin
Hi,

This is similar issue to [ruby-core:30313].
This issue is caused by ISeq#cref_stack instead of ISeq#klass.
This won't be fixed in 1.9.2.

--
Yusuke Endoh
=end

Actions #2

Updated by naruse (Yui NARUSE) over 13 years ago

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

Updated by ko1 (Koichi Sasada) over 13 years ago

  • Target version changed from 1.9.3 to 2.0.0

Let's discuss after 1.9.3. Sorry.

Updated by ko1 (Koichi Sasada) almost 12 years ago

  • Assignee changed from ko1 (Koichi Sasada) to nobu (Nobuyoshi Nakada)

nobu, could you check it?

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0