From: "eightbitraptor (Matthew Valentine-House)" Date: 2022-12-07T16:02:38+00:00 Subject: [ruby-core:111232] [Ruby master Bug#19167] Object#inspect does not correctly show NilClass TrueClass and FalseClass stored in instance variables Issue #19167 has been updated by eightbitraptor (Matthew Valentine-House). It looks like this behaviour was codified in a spec since the commit that @alanwu mentioned was committed. [This commit (a28aa80c739a1d169649a4da833ef48cfb3465b3)](https://github.com/ruby/ruby/commit/a28aa80c739a1d169649a4da833ef48cfb3465b3) introduces the following specs ``` + it "formats a TrueClass VALUE as `TrueClass` if sign not specified in format" do + s = 'Result: TrueClass.' + @s.rb_sprintf3(true.class).should == s + end + + it "formats a TrueClass VALUE as 'true' if sign specified in format" do + s = 'Result: true.' + @s.rb_sprintf4(true.class).should == s + end end ``` This would indicate that the behaviour of "+PRIsVALUE" in `rb_sprintf` is working as intended, and that we shouldn't remove the special casing from `ruby__sfvextra`. ---------------------------------------- Bug #19167: Object#inspect does not correctly show NilClass TrueClass and FalseClass stored in instance variables https://bugs.ruby-lang.org/issues/19167#change-100521 * Author: tompng (tomoya ishida) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin20] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- ~~~ruby Object.new.instance_eval do @a = nil @b = NilClass @c = true @d = TrueClass @e = [nil, NilClass, true, TrueClass] puts self.inspect end # actual # => # # expected # => # ~~~ ---Files-------------------------------- 0001-Fix-Object-inspect-with-NilClass-as-an-ivar.patch (751 Bytes) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/