summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-16 04:06:54 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-16 04:06:54 +0000
commit36c95beb5a38f089e0c93b03c771c3f2b985f4e5 (patch)
tree1ce62830fa5c9ab4778f4dde855cec12192458ba /thread.c
parent33d1cbe9600c5b79d71a303e71a0177190606ad2 (diff)
merges r21578 from trunk into ruby_1_9_1.
* thread.c (call_trace_proc): as Matz said ([ruby-core:21183]), should skip rb_str_new2() if rb_sourcefile() returns NULL. rb_sourcefile() returns NULL if frame is toplevel of Fiber. [ruby-core:21161] [Bug #985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index 8fd5cc8bdf..630176505c 100644
--- a/thread.c
+++ b/thread.c
@@ -3591,8 +3591,9 @@ static VALUE
call_trace_proc(VALUE args, int tracing)
{
struct call_trace_func_args *p = (struct call_trace_func_args *)args;
+ const char *srcfile = rb_sourcefile();
VALUE eventname = rb_str_new2(get_event_name(p->event));
- VALUE filename = rb_str_new2(rb_sourcefile());
+ VALUE filename = srcfile ? rb_str_new2(srcfile) : Qnil;
VALUE argv[6];
int line = rb_sourceline();
ID id = 0;
@@ -3621,7 +3622,7 @@ call_trace_proc(VALUE args, int tracing)
argv[1] = filename;
argv[2] = INT2FIX(line);
argv[3] = id ? ID2SYM(id) : Qnil;
- argv[4] = p->self ? rb_binding_new() : Qnil;
+ argv[4] = (p->self && srcfile) ? rb_binding_new() : Qnil;
argv[5] = klass ? klass : Qnil;
return rb_proc_call_with_block(p->proc, 6, argv, Qnil);