summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--string.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 101fb3bcd9..7913321d07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Mar 3 18:59:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_slice_bang): raise error when the string is frozen.
+
Thu Mar 3 14:25:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
* strftime.c (STRFTIME): return 0 and ERANGE when precision is too
diff --git a/string.c b/string.c
index 770df7f651..19472d991f 100644
--- a/string.c
+++ b/string.c
@@ -3503,9 +3503,9 @@ rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
for (i=0; i<argc; i++) {
buf[i] = argv[i];
}
+ str_modify_keep_cr(str);
result = rb_str_aref_m(argc, buf, str);
if (!NIL_P(result)) {
- str_modify_keep_cr(str);
buf[i] = rb_str_new(0,0);
rb_str_aset_m(argc+1, buf, str);
}