summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-16 15:36:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-16 15:36:38 +0900
commitfce54a5404139a77bd0b7d6f82901083fcb16f1e (patch)
tree96dea163219ecec19dac5b3059b615a52274cd86 /string.c
parent0b6682dc57afc95eca9f75f895ec1bf554697e6c (diff)
Fix `String#partition`
Split with the matched part when the separator matches the empty part at the beginning. [Bug #11014]
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/string.c b/string.c
index 2413fbf8fc..ca425e9780 100644
--- a/string.c
+++ b/string.c
@@ -9795,7 +9795,6 @@ rb_str_partition(VALUE str, VALUE sep)
return rb_ary_new3(3, rb_str_dup(str), str_new_empty(str), str_new_empty(str));
}
sep = rb_str_subpat(str, sep, INT2FIX(0));
- if (pos == 0 && RSTRING_LEN(sep) == 0) goto failed;
}
else {
pos = rb_str_index(str, sep, 0);