summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-23 07:09:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-23 07:09:06 +0000
commite1be1d0c3815be2819f525e3c1d1ec34ccdc398b (patch)
treeeb586d1364627ca90e05c956f232baa24bff741f /string.c
parentb0326bce01af3c6c29a29672875b6618964088bc (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 6cf76e4fd4..ad19595f67 100644
--- a/string.c
+++ b/string.c
@@ -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());