Issue #6454 has been updated by mame (Yusuke Endoh).

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

Aaron, you'd better think we are really lazy :-)
It would be good not only to attach a demonstration patch but also
to write the demonstration in the mail.


  x = Class.new
  y = x.dup
  p x  #=>  #<Class:0x9a96ce0>
  p y  #=>  #<Class:0x9a96cb8>  # they are different as expected,

  x = Class.new
  x.inspect                     # but if #inspect is called before #dup,
  y = x.dup
  p x  #=>  #<Class:0x9113c7c>
  p y  #=>  #<Class:0x9113c7c>  # they become same.


I give +1 to drbrain's patch.

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Bug #6454: Anonymous classes should delete tmp_classpath on dup
https://bugs.ruby-lang.org/issues/6454#change-26741

Author: tenderlovemaking (Aaron Patterson)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2012-05-19 trunk 35705) [x86_64-darwin11.4.0]


When an anonymous class is duped, it should delete tmp_classpath from the iv table so that subsequent calls to `inspect` on the duped class will have different results.

I've attached a test case to demonstrate the problem.


-- 
http://bugs.ruby-lang.org/