Index: string.c =================================================================== --- string.c (revision 23561) +++ string.c (working copy) @@ -6876,6 +6876,7 @@ rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sep)); } + sep = tmp; pos = rb_str_index(str, sep, 0); } if (pos < 0) {