[前][次][番号順一覧][スレッド一覧]

ruby-changes:15643

From: marcandre <ko1@a...>
Date: Fri, 30 Apr 2010 11:49:08 +0900 (JST)
Subject: [ruby-changes:15643] Ruby:r27559 (trunk): * string.c (rb_str_sub_bang): String#sub! now raises an error when

marcandre	2010-04-30 11:48:49 +0900 (Fri, 30 Apr 2010)

  New Revision: 27559

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27559

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/string.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27558)
+++ ChangeLog	(revision 27559)
@@ -1,3 +1,9 @@
+Fri Apr 30 11:48:31 2010  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* 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@m...>
 
 	* eval.c (make_exception, rb_obj_extend): Fix error messages in case
Index: string.c
===================================================================
--- string.c	(revision 27558)
+++ string.c	(revision 27559)
@@ -3466,6 +3466,7 @@
     }
 
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]