Skip to content

Commit

Permalink
* ruby.c (load_file_internal): use original C string as the filename
Browse files Browse the repository at this point in the history
  for parser.
  reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
  [Bug ruby#7562]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Dec 19, 2012
1 parent e90ccd3 commit e446378
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Wed Dec 19 23:52:16 2012 NAKAMURA Usaku <[email protected]>

* 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 <[email protected]>

* marshal.c (marshal_dump, marshal_load): fix SEGV during make rdoc
Expand Down
5 changes: 3 additions & 2 deletions ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ load_file_internal(VALUE arg)
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;
Expand Down Expand Up @@ -1702,10 +1703,10 @@ load_file_internal(VALUE arg)
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)) {
/*
Expand Down

0 comments on commit e446378

Please sign in to comment.