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

ruby-changes:12802

From: wanabe <ko1@a...>
Date: Thu, 13 Aug 2009 21:06:35 +0900 (JST)
Subject: [ruby-changes:12802] Ruby:r24530 (trunk): * vm.c (vm_exec): returning from lambda runs ensure section.

wanabe	2009-08-13 21:06:14 +0900 (Thu, 13 Aug 2009)

  New Revision: 24530

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

  Log:
    * vm.c (vm_exec): returning from lambda runs ensure section.
      [Bug #1729]

  Modified files:
    trunk/ChangeLog
    trunk/vm.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24529)
+++ ChangeLog	(revision 24530)
@@ -1,3 +1,8 @@
+Thu Aug 13 21:01:03 2009  wanabe  <s.wanabe@g...>
+
+	* vm.c (vm_exec): returning from lambda runs ensure section.
+	  [Bug #1729]
+
 Thu Aug 13 18:40:07 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (RUBY_CHECK_SIZEOF): set cross_compiling to yes
Index: vm.c
===================================================================
--- vm.c	(revision 24529)
+++ vm.c	(revision 24530)
@@ -1134,10 +1134,23 @@
 			SET_THROWOBJ_STATE(err, state = TAG_BREAK);
 		    }
 		    else {
-			result = GET_THROWOBJ_VAL(err);
-			th->errinfo = Qnil;
-			th->cfp += 2;
-			goto finish_vme;
+			for (i = 0; i < cfp->iseq->catch_table_size; i++) {
+			    entry = &cfp->iseq->catch_table[i];
+			    if (entry->start < epc && entry->end >= epc) {
+				if (entry->type == CATCH_TYPE_ENSURE) {
+				    catch_iseqval = entry->iseq;
+				    cont_pc = entry->cont;
+				    cont_sp = entry->sp;
+				    break;
+				}
+			    }
+			}
+			if (!catch_iseqval) {
+			    result = GET_THROWOBJ_VAL(err);
+			    th->errinfo = Qnil;
+			    th->cfp += 2;
+			    goto finish_vme;
+			}
 		    }
 		    /* through */
 		}

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

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