summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-20 16:45:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-20 16:45:41 +0000
commitaab1ba1365e1132717cbd8ae8a92014b1bba0854 (patch)
tree77a3e260242dc179917075ae3e9b73f75a60fd3c /eval.c
parent38fc76574a85aa1fbb117fa9d9c5f8c69d76b5e6 (diff)
* eval.c (rb_require_safe): preserve old ruby_errinfo.
[ruby-talk:95409] * eval.c (rb_f_raise): should not clear backtrace information if exception object already have one. * parse.y (assoc_list): allow {sym: val} style Hash. [Ruby2] this change is done by Nobuyoshi Nakada <nobu@ruby-lang.org>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 45dc8320d5..f2d8c9b667 100644
--- a/eval.c
+++ b/eval.c
@@ -4410,7 +4410,8 @@ rb_f_raise(argc, argv)
if (argc > 0) {
if (!rb_obj_is_kind_of(mesg, rb_eException))
rb_raise(rb_eTypeError, "exception object expected");
- set_backtrace(mesg, (argc>2)?argv[2]:Qnil);
+ if (argc>2)
+ set_backtrace(mesg, argv[2]);
}
if (ruby_frame != top_frame) {
@@ -5549,7 +5550,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
rb_raise(rb_eArgError, "wrong number of arguments(%d for %d)",
argc, i);
}
- if (node->nd_rest == -1) {
+ if ((int)node->nd_rest == -1) {
int opt = i;
NODE *optnode = node->nd_opt;
@@ -5584,7 +5585,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
}
}
local_vars = ruby_scope->local_vars;
- if (node->nd_rest >= 0) {
+ if ((int)node->nd_rest >= 0) {
VALUE v;
if (argc > 0)
@@ -6705,6 +6706,7 @@ rb_require_safe(fname, safe)
int safe;
{
VALUE result = Qnil;
+ volatile VALUE errinfo = ruby_errinfo;
int state;
struct {
NODE *node;
@@ -6782,7 +6784,7 @@ rb_require_safe(fname, safe)
if (NIL_P(result)) {
load_failed(fname);
}
- ruby_errinfo = Qnil;
+ ruby_errinfo = errinfo;
return result;
}