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

ruby-changes:10035

From: ko1 <ko1@a...>
Date: Fri, 16 Jan 2009 01:46:08 +0900 (JST)
Subject: [ruby-changes:10035] Ruby:r21578 (trunk): * thread.c (call_trace_proc): as Matz said (),

ko1	2009-01-16 01:45:41 +0900 (Fri, 16 Jan 2009)

  New Revision: 21578

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

  Log:
    * 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]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21577)
+++ ChangeLog	(revision 21578)
@@ -1,3 +1,10 @@
+Fri Jan 16 01:42:50 2009  Koichi Sasada  <ko1@a...>
+
+	* 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]
+
 Fri Jan 16 01:09:37 2009  Koichi Sasada  <ko1@a...>
 
 	* ruby.c (process_options): decrement parse_in_eval to recognize
Index: thread.c
===================================================================
--- thread.c	(revision 21577)
+++ thread.c	(revision 21578)
@@ -3624,8 +3624,9 @@
 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;
@@ -3654,7 +3655,7 @@
     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);

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

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