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

ruby-changes:40281

From: usa <ko1@a...>
Date: Thu, 29 Oct 2015 23:56:11 +0900 (JST)
Subject: [ruby-changes:40281] usa:r52362 (ruby_2_1): merge revision(s) 45576: [Backport #11572]

usa	2015-10-29 23:56:00 +0900 (Thu, 29 Oct 2015)

  New Revision: 52362

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

  Log:
    merge revision(s) 45576: [Backport #11572]
    
    * string.c (sym_to_proc), proc.c (rb_block_clear_env_self): clear
      caller's self which is useless, so that it can get collected.
      [Fixes GH-592]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/internal.h
    branches/ruby_2_1/proc.c
    branches/ruby_2_1/string.c
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 52361)
+++ ruby_2_1/ChangeLog	(revision 52362)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Thu Oct 29 23:54:35 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (sym_to_proc), proc.c (rb_block_clear_env_self): clear
+	  caller's self which is useless, so that it can get collected.
+	  [Fixes GH-592]
+
 Thu Oct 29 23:30:20 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* lib/ipaddr.rb, test/test_ipaddr.rb: Reject invalid address contained
Index: ruby_2_1/string.c
===================================================================
--- ruby_2_1/string.c	(revision 52361)
+++ ruby_2_1/string.c	(revision 52362)
@@ -8540,6 +8540,7 @@ sym_to_proc(VALUE sym) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/string.c#L8540
     }
     else {
 	proc = rb_proc_new(sym_call, (VALUE)id);
+	rb_block_clear_env_self(proc);
 	aryp[index] = sym;
 	aryp[index + 1] = proc;
 	return proc;
Index: ruby_2_1/proc.c
===================================================================
--- ruby_2_1/proc.c	(revision 52361)
+++ ruby_2_1/proc.c	(revision 52362)
@@ -637,6 +637,17 @@ rb_block_lambda(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/proc.c#L637
 }
 
 VALUE
+rb_block_clear_env_self(VALUE proc)
+{
+    rb_proc_t *po;
+    rb_env_t *env;
+    GetProcPtr(proc, po);
+    GetEnvPtr(po->envval, env);
+    env->env[0] = Qnil;
+    return proc;
+}
+
+VALUE
 rb_f_lambda(void)
 {
     rb_warn("rb_f_lambda() is deprecated; use rb_block_proc() instead");
Index: ruby_2_1/internal.h
===================================================================
--- ruby_2_1/internal.h	(revision 52361)
+++ ruby_2_1/internal.h	(revision 52362)
@@ -630,6 +630,7 @@ void rb_gc_mark_symbols(int full_mark); https://github.com/ruby/ruby/blob/trunk/ruby_2_1/internal.h#L630
 VALUE rb_proc_location(VALUE self);
 st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
 int rb_block_arity(void);
+VALUE rb_block_clear_env_self(VALUE proc);
 
 /* process.c */
 #define RB_MAX_GROUPS (65536)
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 52361)
+++ ruby_2_1/version.h	(revision 52362)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.8"
 #define RUBY_RELEASE_DATE "2015-10-29"
-#define RUBY_PATCHLEVEL 411
+#define RUBY_PATCHLEVEL 412
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 10

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45576


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

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