diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-27 01:16:25 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-27 01:16:25 +0000 |
commit | d090f17f21c1b938e9aa97c14e9e2d7e079b4420 (patch) | |
tree | 517d6d448e3a5b50b908e7ca19b822f88cc8d873 /iseq.c | |
parent | 197e7b812c8ab14a7b61b7d0425c70768453ac65 (diff) | |
download | ruby-d090f17f21c1b938e9aa97c14e9e2d7e079b4420.tar.gz |
* iseq.c (rb_iseq_compile_with_option): Instead of testing
respond_to, just check if the argument is actually a file,
because by calling user-defined gets something weired can
happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861]
* parse.y (ripper_initialize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -590,11 +590,16 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE li if ((state = EXEC_TAG()) == 0) { int ln = NUM2INT(line); const char *fn = StringValueCStr(file); - NODE *node = parse_string(StringValue(src), fn, ln); + NODE *node; rb_compile_option_t option; make_compile_option(&option, opt); + if (RB_TYPE_P((src), T_FILE)) + node = rb_compile_file(fn, src, ln); + else + node = parse_string(StringValue(src), fn, ln); + if (base_block && base_block->iseq) { iseqval = rb_iseq_new_with_opt(node, base_block->iseq->location.label, file, absolute_path, line, base_block->iseq->self, |