Permalink
Browse files

* string.c (rb_str_sub_bang): String#sub! now raises an error when

  called on a frozen string, even if no change is made.
  See [ruby-core:23657]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
marcandre committed Apr 30, 2010
1 parent 478c3e0 commit 479fa407780ca01ce04dce1ef21342da4e148215
Showing with 7 additions and 0 deletions.
  1. +6 −0 ChangeLog
  2. +1 −0 string.c
View
@@ -1,3 +1,9 @@
+Fri Apr 30 11:48:31 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * string.c (rb_str_sub_bang): String#sub! now raises an error when
+ called on a frozen string, even if no change is made.
+ See [ruby-core:23657]
+
Fri Apr 30 11:40:44 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* eval.c (make_exception, rb_obj_extend): Fix error messages in case
View
@@ -3466,6 +3466,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
}
pat = get_pat(argv[0], 1);
+ str_modifiable(str);
if (rb_reg_search(pat, str, 0, 0) >= 0) {
rb_encoding *enc;
int cr = ENC_CODERANGE(str);

0 comments on commit 479fa40

Please sign in to comment.