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

ruby-changes:26423

From: usa <ko1@a...>
Date: Wed, 19 Dec 2012 23:54:59 +0900 (JST)
Subject: [ruby-changes:26423] usa:r38474 (trunk): * ruby.c (load_file_internal): use original C string as the filename

usa	2012-12-19 23:54:50 +0900 (Wed, 19 Dec 2012)

  New Revision: 38474

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

  Log:
    * ruby.c (load_file_internal): use original C string as the filename
      for parser.
      reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
      [Bug #7562]

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38473)
+++ ChangeLog	(revision 38474)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 19 23:52:16 2012  NAKAMURA Usaku  <usa@r...>
+
+	* ruby.c (load_file_internal): use original C string as the filename
+	  for parser.
+	  reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
+	  [Bug #7562]
+
 Wed Dec 19 23:36:12 2012  Naohisa Goto  <ngotogenome@g...>
 
 	* marshal.c (marshal_dump, marshal_load): fix SEGV during make rdoc
Index: ruby.c
===================================================================
--- ruby.c	(revision 38473)
+++ ruby.c	(revision 38474)
@@ -1569,6 +1569,7 @@ load_file_internal(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1569
     VALUE parser = argp->parser;
     VALUE fname_v = rb_str_encode_ospath(argp->fname);
     const char *fname = StringValueCStr(fname_v);
+    const char *orig_fname = StringValueCStr(argp->fname);
     int script = argp->script;
     struct cmdline_options *opt = argp->opt;
     VALUE f;
@@ -1702,10 +1703,10 @@ load_file_internal(VALUE arg) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1703
     if (NIL_P(f)) {
 	f = rb_str_new(0, 0);
 	rb_enc_associate(f, enc);
-	return (VALUE)rb_parser_compile_string(parser, fname, f, line_start);
+	return (VALUE)rb_parser_compile_string(parser, orig_fname, f, line_start);
     }
     rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
-    tree = rb_parser_compile_file(parser, fname, f, line_start);
+    tree = rb_parser_compile_file(parser, orig_fname, f, line_start);
     rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
     if (script && tree && rb_parser_end_seen_p(parser)) {
 	/*

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

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