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

ruby-changes:33294

From: nagachika <ko1@a...>
Date: Thu, 20 Mar 2014 21:22:25 +0900 (JST)
Subject: [ruby-changes:33294] nagachika:r45373 (ruby_2_0_0): merge revision(s) r45350: [Backport #9645]

nagachika	2014-03-20 21:22:17 +0900 (Thu, 20 Mar 2014)

  New Revision: 45373

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

  Log:
    merge revision(s) r45350: [Backport #9645]
    
    * variable.c (rb_const_set): delete existing entry on redefinition
      [Bug #9645]
    
    * test/ruby/test_const.rb (test_redefinition): test for leak

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_const.rb
    branches/ruby_2_0_0/variable.c
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45372)
+++ ruby_2_0_0/ChangeLog	(revision 45373)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu Mar 20 21:13:18 2014  Eric Wong  <e@8...>
+
+	* variable.c (rb_const_set): delete existing entry on redefinition
+	  [Bug #9645]
+	* test/ruby/test_const.rb (test_redefinition): test for leak
+
 Thu Mar 20 20:44:17 2014  Kazuki Tsujimoto  <kazuki@c...>
 
 	* test/fiddle/test_c_struct_entry.rb,
Index: ruby_2_0_0/variable.c
===================================================================
--- ruby_2_0_0/variable.c	(revision 45372)
+++ ruby_2_0_0/variable.c	(revision 45373)
@@ -2183,6 +2183,8 @@ rb_const_set(VALUE klass, ID id, VALUE v https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/variable.c#L2183
 		    rb_compile_warn(RSTRING_PTR(ce->file), ce->line,
 				    "previous definition of %"PRIsVALUE" was here", name);
 		}
+		st_delete(RCLASS_CONST_TBL(klass), &id, 0);
+		xfree(ce);
 	    }
 	}
     }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 45372)
+++ ruby_2_0_0/version.h	(revision 45373)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-03-20"
-#define RUBY_PATCHLEVEL 460
+#define RUBY_PATCHLEVEL 461
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_0_0/test/ruby/test_const.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_const.rb	(revision 45372)
+++ ruby_2_0_0/test/ruby/test_const.rb	(revision 45373)
@@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_const.rb#L1
 # -*- coding: us-ascii -*-
 require 'test/unit'
+require_relative 'envutil'
 
 class TestConst < Test::Unit::TestCase
   TEST1 = 1
@@ -54,5 +55,12 @@ class TestConst < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_const.rb#L55
 #{__FILE__}:#{__LINE__-1}: warning: already initialized constant #{c}::X
 #{__FILE__}:#{__LINE__-3}: warning: previous definition of X was here
 WARNING
+    code = <<-PRE
+olderr = $stderr.dup
+$stderr.reopen(File::NULL, "wb")
+350000.times { FOO = :BAR }
+$stderr.reopen(olderr)
+PRE
+    assert_no_memory_leak([], '', code, 'redefined constant')
   end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45350


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

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