summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-14 10:53:53 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-14 10:53:53 (GMT)
commit14c3aa52aeff4fed170b3dbe8666aaa851b654d2 (patch)
tree6f2a895bac75e382b9d4e71e1bb09f92cdafbc4b
parent9cdeae9dad9f8ac8fe50b6b6f01ecd76f21f5e6b (diff)
* proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move
init place of exception_error. * inits.c: ditto. * eval.c (Init_eval): set exception_error#throwed_state as TAG_FATAL. [ruby-dev:31407] * bootstraptest/test_exception.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--bootstraptest/test_exception.rb23
-rw-r--r--eval.c7
-rw-r--r--eval_intern.h2
-rw-r--r--ext/win32ole/win32ole.c2
-rw-r--r--inits.c2
-rw-r--r--insnhelper.h2
-rw-r--r--proc.c2
8 files changed, 44 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index d0d1c5f..8aac399 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Tue Aug 14 19:53:15 2007 Koichi Sasada <ko1@atdot.net>
+
+ * proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move
+ init place of exception_error.
+
+ * inits.c: ditto.
+
+ * eval.c (Init_eval): set exception_error#throwed_state as TAG_FATAL.
+ [ruby-dev:31407]
+
+ * bootstraptest/test_exception.rb: add a test for above.
+
Tue Aug 14 19:51:20 2007 Koichi Sasada <ko1@atdot.net>
* common.mk: change test order (test -> btest).
diff --git a/bootstraptest/test_exception.rb b/bootstraptest/test_exception.rb
index 79d7388..85ed946 100644
--- a/bootstraptest/test_exception.rb
+++ b/bootstraptest/test_exception.rb
@@ -368,3 +368,26 @@ assert_equal %q{}, %q{
end
end.call
}
+
+##
+assert_equal "ok", %q{
+ $foo = "ok"
+ class C
+ def inspect
+ bar {}
+ $foo = "ng"
+ end
+
+ def bar
+ raise
+ ensure
+ end
+ end
+
+ begin
+ C.new.foo
+ rescue NoMethodError => e
+ $foo
+ end
+}, "[ruby-dev:31407]"
+
diff --git a/eval.c b/eval.c
index 43bf9a0..a71bff2 100644
--- a/eval.c
+++ b/eval.c
@@ -29,9 +29,10 @@ static ID object_id, __send, __send_bang, respond_to;
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
-VALUE exception_error;
VALUE sysstack_error;
+static VALUE exception_error;
+
static VALUE eval(VALUE, VALUE, VALUE, const char *, int);
static inline VALUE rb_yield_0(int argc, VALUE *argv);
@@ -2726,6 +2727,10 @@ Init_eval(void)
rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
rb_define_virtual_variable("$SAFE", safe_getter, safe_setter);
+
+ exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
+ rb_ivar_set(exception_error, idThrowState, INT2FIX(TAG_FATAL));
+ rb_register_mark_object(exception_error);
}
diff --git a/eval_intern.h b/eval_intern.h
index 7b89ed3..8ee1625 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -177,8 +177,6 @@ char *strrchr _((const char *, const char));
ruby_cref()->nd_visi = (f); \
}
-extern VALUE exception_error;
-
void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void));
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 42336e7..efa5760 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -2014,7 +2014,7 @@ typelib_file_from_typelib(VALUE ole)
if (ver == Qnil)
break;
err = reg_open_vkey(hclsid, ver, &hversion);
- if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
+ if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
continue;
fver = atof(StringValuePtr(ver));
typelib = reg_get_val(hversion, NULL);
diff --git a/inits.c b/inits.c
index 302f1c6..4b9da09 100644
--- a/inits.c
+++ b/inits.c
@@ -63,10 +63,10 @@ rb_call_inits()
Init_Comparable();
Init_Enumerable();
Init_Precision();
+ Init_Exception();
Init_eval();
Init_jump();
Init_String();
- Init_Exception();
Init_Numeric();
Init_Bignum();
Init_syserr();
diff --git a/insnhelper.h b/insnhelper.h
index 59536b2..4516a55 100644
--- a/insnhelper.h
+++ b/insnhelper.h
@@ -62,7 +62,7 @@
#define GET_OPERAND(n) (GET_PC()[(n)])
#define ADD_PC(n) (SET_PC(REG_PC + (n)))
-#define GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
+#define GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
#define JUMP(dst) (REG_PC += (dst))
/* FP */
diff --git a/proc.c b/proc.c
index d5c0ce4..507f1a8 100644
--- a/proc.c
+++ b/proc.c
@@ -1443,8 +1443,6 @@ Init_Proc(void)
rb_eLocalJumpError = rb_define_class("LocalJumpError", rb_eStandardError);
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
- exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
- rb_register_mark_object(exception_error);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eException);
sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");