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

ruby-changes:15879

From: mame <ko1@a...>
Date: Sun, 16 May 2010 17:19:08 +0900 (JST)
Subject: [ruby-changes:15879] Ruby:r27817 (trunk): * proc.c (proc_binding): don't propagative filename and line_no of

mame	2010-05-16 17:18:49 +0900 (Sun, 16 May 2010)

  New Revision: 27817

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

  Log:
    * proc.c (proc_binding): don't propagative filename and line_no of
      binding that is created from C level.  [ruby-dev:41322]
    
    * vm_eval.c (eval_string_with_cref): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/vm_eval.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27816)
+++ ChangeLog	(revision 27817)
@@ -1,3 +1,10 @@
+Sun May 16 17:16:09 2010  Yusuke Endoh  <mame@t...>
+
+	* proc.c (proc_binding): don't propagative filename and line_no of
+	  binding that is created from C level.  [ruby-dev:41322]
+
+	* vm_eval.c (eval_string_with_cref): ditto.
+
 Sun May 16 15:09:36 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* dln.c (rb_w32_check_imported): check if extension library to be
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 27816)
+++ vm_eval.c	(revision 27817)
@@ -966,7 +966,7 @@
 	    if (rb_obj_is_kind_of(scope, rb_cBinding)) {
 		GetBindingPtr(scope, bind);
 		envval = bind->env;
-		if (strcmp(file, "(eval)") == 0) {
+		if (strcmp(file, "(eval)") == 0 && bind->filename != Qnil) {
 		    file = RSTRING_PTR(bind->filename);
 		    line = bind->line_no;
 		}
Index: proc.c
===================================================================
--- proc.c	(revision 27816)
+++ proc.c	(revision 27817)
@@ -1897,8 +1897,14 @@
     bindval = binding_alloc(rb_cBinding);
     GetBindingPtr(bindval, bind);
     bind->env = proc->envval;
-    bind->filename = proc->block.iseq->filename;
-    bind->line_no = rb_iseq_first_lineno(proc->block.iseq);
+    if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
+	bind->filename = proc->block.iseq->filename;
+	bind->line_no = rb_iseq_first_lineno(proc->block.iseq);
+    }
+    else {
+	bind->filename = Qnil;
+	bind->line_no = 0;
+    }
     return bindval;
 }
 

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

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