Project

General

Profile

Backport #954

OpenStruct#inspect recursion detection is buggy

Added by murphy (Kornelius Kalnbach) almost 11 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:20992]

Description

=begin
Currently, OpenStruct#inspect shows a recursion indicator whenever a member of an OpenStruct is an OpenStruct itself:

foo = OpenStruct.new
foo.bar = OpenStruct.new
foo.inspect # => #>

I expect it to do the following:

foo = OpenStruct.new
foo.bar = OpenStruct.new
assert_equal('#>', foo.inspect)
foo.bar.foo = foo
assert_equal('#>>', foo.inspect)

Path attached. It uses the code pattern found in Set#inspect, using object_ids instead of objects for the :inspect_key stack.

It should be fixed in Ruby 1.8.6 and 1.8.7, too.
=end


Files

fix-ostruct-inspect.diff (1.47 KB) fix-ostruct-inspect.diff Patch for OpenStruct#inspect with test case murphy (Kornelius Kalnbach), 12/30/2008 11:49 PM

History

#1

Updated by yugui (Yuki Sonoda) almost 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21496.
=end

#2

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Status changed from Closed to Open
  • Assignee set to shyouhei (Shyouhei Urabe)
  • ruby -v set to ruby 1.8.7 (2009-04-02 patchlevel 159) [x86_64-linux]

=begin

=end

#3

Updated by shyouhei (Shyouhei Urabe) over 10 years ago

  • Assignee changed from shyouhei (Shyouhei Urabe) to wyhaines (Kirk Haines)

=begin

=end

#4

Updated by wyhaines (Kirk Haines) over 10 years ago

  • Status changed from Open to Closed

=begin
This was fixed in r24025.
=end

Also available in: Atom PDF