summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--eval.c13
2 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 77ec99be86..3416e624f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Sep 17 23:41:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (localjump_destination): should not raise ThreadError
+ exception for "break". [ruby-dev:21348]
+
+ * eval.c (proc_invoke): use result instead of prot_tag->retval.
+ retval is no longer propagated to the ancestors.
+
Wed Sep 17 20:34:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (tokadd_string, parse_string, yylex): escaped terminator
diff --git a/eval.c b/eval.c
index 4eeb9670b9..7cc68613a3 100644
--- a/eval.c
+++ b/eval.c
@@ -1487,15 +1487,15 @@ rb_eval_string_wrap(str, state)
}
static void
-localjump_error(mesg, status, reason)
+localjump_error(mesg, value, reason)
const char *mesg;
- VALUE status;
+ VALUE value;
int reason;
{
VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
VALUE id;
- rb_iv_set(exc, "@exit_value", status);
+ rb_iv_set(exc, "@exit_value", value);
switch (reason) {
case TAG_BREAK:
id = rb_intern("break"); break;
@@ -4028,7 +4028,7 @@ localjump_destination(state, scope, retval)
if (retval == Qundef) retval = Qnil;
while (tt) {
- if (tt->tag == PROT_PCALL ||
+ if (tt->tag == PROT_PCALL || (tt->tag == PROT_THREAD && state == TAG_BREAK) ||
(tt->tag == PROT_CALL || tt->tag == tag) && tt->scope == scope) {
tt->dst = (VALUE)scope;
tt->retval = retval;
@@ -4036,8 +4036,7 @@ localjump_destination(state, scope, retval)
}
if (tt->tag == PROT_FUNC && tt->scope == scope) break;
if (tt->tag == PROT_THREAD) {
- rb_raise(rb_eThreadError, "%s jump can't across threads",
- (state == TAG_BREAK) ? "break" : "return");
+ rb_raise(rb_eThreadError, "return jump can't across threads");
}
tt = tt->prev;
}
@@ -7061,7 +7060,7 @@ proc_invoke(proc, args, self, klass)
char mesg[32];
snprintf(mesg, sizeof mesg, "%s from proc-closure",
state == TAG_BREAK ? "break" : "return");
- localjump_error(mesg, prot_tag->retval, state);
+ localjump_error(mesg, result, state);
}
if (result != Qundef) {
localjump_destination(state, ruby_scope, result);