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

ruby-changes:44768

From: nagachika <ko1@a...>
Date: Sat, 19 Nov 2016 14:18:55 +0900 (JST)
Subject: [ruby-changes:44768] nagachika:r56841 (ruby_2_3): * iseq.c (proc_dup): don't duplicate sym_procs. [Fix GH-1479]

nagachika	2016-11-19 14:18:49 +0900 (Sat, 19 Nov 2016)

  New Revision: 56841

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

  Log:
    * iseq.c (proc_dup): don't duplicate sym_procs.  [Fix GH-1479]
      [ruby-core:78100] [Bug #12927]
      Based on the patch provided by Emiliano Ritiro.

  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/proc.c
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 56840)
+++ ruby_2_3/ChangeLog	(revision 56841)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sat Nov 19 14:06:07 2016  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* iseq.c (proc_dup): don't duplicate sym_procs.  [Fix GH-1479]
+	  [ruby-core:78100] [Bug #12927]
+	  Based on the patch provided by Emiliano Ritiro.
+
 Sat Nov 19 11:48:47 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* iseq.c (iseqw_s_compile_file): deal with syntax error as well as
Index: ruby_2_3/proc.c
===================================================================
--- ruby_2_3/proc.c	(revision 56840)
+++ ruby_2_3/proc.c	(revision 56841)
@@ -65,11 +65,13 @@ typedef struct { https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L65
     VALUE env[3]; /* me, specval, envval */
 } cfunc_proc_t;
 
+#define IS_SYM_PROC(proc) (proc->block.ep == ((const cfunc_proc_t *)proc)->env+1)
+
 static size_t
 proc_memsize(const void *ptr)
 {
     const rb_proc_t *proc = ptr;
-    if (proc->block.ep == ((const cfunc_proc_t *)ptr)->env+1)
+    if (IS_SYM_PROC(proc))
 	return sizeof(cfunc_proc_t);
     return sizeof(rb_proc_t);
 }
@@ -111,6 +113,8 @@ proc_dup(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L113
     rb_proc_t *dst;
 
     GetProcPtr(self, src);
+    if (IS_SYM_PROC(src))
+	return self;
     procval = rb_proc_alloc(rb_cProc);
     GetProcPtr(procval, dst);
     *dst = *src;
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56840)
+++ ruby_2_3/version.h	(revision 56841)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.3"
 #define RUBY_RELEASE_DATE "2016-11-19"
-#define RUBY_PATCHLEVEL 220
+#define RUBY_PATCHLEVEL 221
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 11

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

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