diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-23 07:09:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-23 07:09:06 +0000 |
commit | e1be1d0c3815be2819f525e3c1d1ec34ccdc398b (patch) | |
tree | eb586d1364627ca90e05c956f232baa24bff741f /string.c | |
parent | b0326bce01af3c6c29a29672875b6618964088bc (diff) |
dup String#rpartition return value
* string.c (rb_str_rpartition): return duplicated receiver, when
no splits. [ruby-core:82911] [Bug#13925]
Author: Seiei Miyagi <hanachin@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -9177,7 +9177,7 @@ rb_str_rpartition(VALUE str, VALUE sep) pos = rb_str_rindex(str, sep, pos); } if (pos < 0) { - return rb_ary_new3(3, str_new_empty(str), str_new_empty(str), str); + return rb_ary_new3(3, str_new_empty(str), str_new_empty(str), rb_str_dup(str)); } if (regex) { sep = rb_reg_nth_match(0, rb_backref_get()); |