Actions
Bug #1510
closed[patch] String#partition can return wrong result or crash
Description
=begin
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.
=end
Files
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r23562.
=end
Updated by marcandre (Marc-Andre Lafortune) over 15 years ago
=begin
Thanks, that was really quick!
I just noticed that rpartition has the same problem...
=end
Actions
Like0
Like0Like0