When call Kernel#singleton_class. And instance variables disappeared from Kernel#inspect. #266

Closed
kachick opened this Issue Aug 21, 2012 · 2 comments

Projects

None yet

2 participants

@kachick
kachick commented Aug 21, 2012

Are below behaviors expected in JRuby?

$VERBOSE = true

class Foo

  def initialize(bool)
    @pre = 1

    if bool
      singleton_class
    end

    @post = 2
  end

end

p Foo.new(true)
p Foo.new(false)

CRuby

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

#<Foo:0x858b8b4 @pre=1, @post=2>
#<Foo:0x858b814 @pre=1, @post=2>

JRuby

jruby 1.7.0.preview2 (1.9.3p203) 2012-08-21 82eb396 on OpenJDK Server VM 1.6.0_24-b24 [linux-i386]

#<Foo:0xb655a>
#<Foo:0x2b1682 @pre=1, @post=2>
@headius
Member
headius commented Aug 21, 2012

Definitely a bug, but it seems to only affect inspect...the variables are still there.

@headius headius added a commit that closed this issue Aug 21, 2012
@headius headius Fix #266.
We weren't using the "real class", which has the ivar list.
9dc5553
@headius headius closed this in 9dc5553 Aug 21, 2012
@kachick
kachick commented Aug 22, 2012

Thanks!

@eregon eregon added a commit that referenced this issue Jun 27, 2016
@eregon eregon Squashed 'spec/ruby/' changes from 842119c..9b80404
9b80404 Use the block-style for #fork to clarify which is child/parent
6105e6f Fix process leak in define_finalizer spec
0d16336 Set the thread-local variable on a fresh thread to avoid adding one to the main thread
6d6085b Add some specs for Fiber#resume and Fiber#transfer
d74074c Fix name of Thread#thread_variable? spec
d2646aa Clean up after some Fiber specs.
ea9ba0f A couple Thread, Fiber spec fixes.
3f3bfc9 Specs for Thread#thread_variable{s, _get, _set, _key?}.
7e0030d Added ObjectSpace.define_finalizer specs.
e36507d Improve coverage of Range#== and Range#eql? specs.
2b8f656 [Truffle] Complete implementation of RSTRING_PTR.
692a8c7 Add specs for Encoding.compatible?(String, Encoding).
7da8db1 Add specs for Encoding.compatible?'s special handling of empty strings.
7686226 Simplify scope changes in WeakRef#__send__ spec
2ad4c51 Remove useless GC.start
797a4ca Add a spec for `if $0 ==  __FILE__` with relative paths.
d4fe65c [Truffle] Implement rb_funcall and rb_proc_new.
517fba5 [Truffle] Pass all of Module C-extension specs.
27fdf70 Fix description in rb_define_global_function spec
cc2bbcc Specify what kind of NameError is acceptable for missing class variables
202d106 Merge pull request #270 from odaira/myContribution
9cdea79 Skip specs for getsockopt that are known to fail due to a bug in AIX
8190a7c Close dup'd fd in Readline#readline spec
1eddcf4 Fix spec trying to join a random process group
0e41add Merge pull request #269 from odaira/myContribution
2ded765 Avoid using the "daemon" group because it might not exist
4025994 Merge pull request #268 from rhenium/skip-openssl-random-pesudo_bytes
be27946 Skip OpenSSL::Random.pseudo_bytes if not defined
5c234e5 Revert "Fix of MRI Bug 12367 was backported to 2.3 and 2.2"
16c1d6a Fix of MRI Bug 12367 was backported to 2.3 and 2.2
391bc02 Fix guards for C-API constants
3ab19e5 Merge pull request #267 from nobu/integer-unification
e7d61e0 Remove `rb_cFixnum` and `rb_cBignum`
47d1d0f Merge 2 lines affecting the same variable in Process#setsid
033ee7d Merge pull request #266 from odaira/myContribution
c14030f AIX does not allow Process.getsid(pid) if pid is in a different session
6c15fa6 Merge pull request #265 from iliabylich/mark-unsupported-specs-for-opal-as-unsupported
4375899 Wrapped String#rindex specs containing regexp anchors with `not_supported_on :opal`.
fea9678 Merge pull request #263 from duerst/Unicode-case-mapping
0eef655 Update case mapping related in preparation for Unicode case mapping

git-subtree-dir: spec/ruby
git-subtree-split: 9b80404bef43b67d0f9a82ab3005ffcbc1be49cd
7727828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment