[macruby-changes] [5178] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 17 06:58:07 PST 2011


Revision: 5178
          http://trac.macosforge.org/projects/ruby/changeset/5178
Author:   watson1978 at gmail.com
Date:     2011-01-17 06:58:01 -0800 (Mon, 17 Jan 2011)
Log Message:
-----------
String#initialize will raise a RuntimeError with frozen object of self.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

s = "hello".freeze
assert_raise(RuntimeError){ s.send(:initialize, s) }

puts :ok
}}}

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2011-01-17 13:17:32 UTC (rev 5177)
+++ MacRuby/trunk/string.c	2011-01-17 14:58:01 UTC (rev 5178)
@@ -1686,6 +1686,7 @@
 {
     VALUE orig;
     if (argc > 0 && rb_scan_args(argc, argv, "01", &orig) == 1) {
+	rstr_modify(self);
 	if (self != orig) {
 	    rstr_replace(self, 0, orig);
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110117/aa945309/attachment-0001.html>


More information about the macruby-changes mailing list