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

ruby-changes:34564

From: nobu <ko1@a...>
Date: Wed, 2 Jul 2014 02:14:58 +0900 (JST)
Subject: [ruby-changes:34564] nobu:r46645 (trunk): proc.c: fix infinite loop

nobu	2014-07-02 02:14:48 +0900 (Wed, 02 Jul 2014)

  New Revision: 46645

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

  Log:
    proc.c: fix infinite loop
    
    * proc.c (bind_local_variables): update env from envval for each
      iterations.  [ruby-dev:48351] [Bug #10001]

  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/test/ruby/test_proc.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46644)
+++ ChangeLog	(revision 46645)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul  2 02:14:37 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* proc.c (bind_local_variables): update env from envval for each
+	  iterations.  [ruby-dev:48351] [Bug #10001]
+
 Tue Jul  1 23:46:34 2014  NAKAMURA Usaku  <usa@r...>
 
 	* NEWS: [DOC] mention about Binding#local_variables, introduced at
Index: proc.c
===================================================================
--- proc.c	(revision 46644)
+++ proc.c	(revision 46645)
@@ -476,12 +476,13 @@ bind_local_variables(VALUE bindval) https://github.com/ruby/ruby/blob/trunk/proc.c#L476
     GetBindingPtr(bindval, bind);
 
     envval = bind->env;
-    GetEnvPtr(envval, env);
 
     do {
 	const rb_iseq_t *iseq;
 	int i;
 	ID id;
+
+	GetEnvPtr(envval, env);
 	iseq = env->block.iseq;
 
 	for (i = 0; i < iseq->local_table_size; i++) {
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb	(revision 46644)
+++ test/ruby/test_proc.rb	(revision 46645)
@@ -1256,6 +1256,11 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_proc.rb#L1256
     assert_equal(%i[if case when begin end a], b.local_variables)
   end
 
+  def test_local_variables_nested
+    b = tap {break binding}
+    assert_equal(%i[b], b.local_variables, '[ruby-dev:48351] [Bug #10001]')
+  end
+
   def local_variables_of(bind)
     this_should_not_be_in_bind = 2
     bind.local_variables

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

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