Bug #1510: [patch] String#partition can return wrong result or crash
http://redmine.ruby-lang.org/issues/show/1510

Author: Marc-Andre Lafortune
Status: Open, Priority: Normal
Category: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-05-24 trunk 23557) [i386-darwin9.7.0]

The attached patch fixes a problem that occurs when the argument of String#partition needs to be converted using :to_str.

E.g:

class C
  def to_str
    "foo"
  end
end
p "foo-bar".partition(C.new)

Before patch:
["", #<C:0x2c62a8>, "foo-bar"]

After patch:
["", "foo", "-bar"]

RubySpecs has been updated. Without the version guard, it crashes Ruby.


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