merge revision(s) 42103: [Backport #8662]

* vm_eval.c (eval_string_with_cref): use the given file name unless
	  eval even if scope is given.  additional fix for [Bug #8436].
	  based on the patch by srawlins at [ruby-core:56099] [Bug #8662].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-07-22 15:13:18 +00:00
parent 7029875b20
commit 65dc7d004e
4 changed files with 15 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Tue Jul 23 00:00:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (eval_string_with_cref): use the given file name unless
eval even if scope is given. additional fix for [Bug #8436].
based on the patch by srawlins at [ruby-core:56099] [Bug #8662].
Sat Jul 20 23:49:33 2013 NAKAMURA Usaku <usa@ruby-lang.org> Sat Jul 20 23:49:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* test/drb/drbtest.rb (Drb{Core,Ary}#teardown): retry Process.kill * test/drb/drbtest.rb (Drb{Core,Ary}#teardown): retry Process.kill

View file

@ -508,6 +508,8 @@ class TestMethod < Test::Unit::TestCase
assert_equal(File.dirname(File.realpath(__FILE__)), __dir__) assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
bug8436 = '[ruby-core:55123] [Bug #8436]' bug8436 = '[ruby-core:55123] [Bug #8436]'
assert_equal(__dir__, eval("__dir__", binding), bug8436) assert_equal(__dir__, eval("__dir__", binding), bug8436)
bug8662 = '[ruby-core:56099] [Bug #8662]'
assert_equal("arbitrary", eval("__dir__", binding, "arbitrary/file.rb"), bug8662)
end end
def test_alias_owner def test_alias_owner

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-07-20" #define RUBY_RELEASE_DATE "2013-07-23"
#define RUBY_PATCHLEVEL 273 #define RUBY_PATCHLEVEL 274
#define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 7 #define RUBY_RELEASE_MONTH 7
#define RUBY_RELEASE_DAY 20 #define RUBY_RELEASE_DAY 23
#include "ruby/version.h" #include "ruby/version.h"

View file

@ -1198,7 +1198,10 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
if (rb_obj_is_kind_of(scope, rb_cBinding)) { if (rb_obj_is_kind_of(scope, rb_cBinding)) {
GetBindingPtr(scope, bind); GetBindingPtr(scope, bind);
envval = bind->env; envval = bind->env;
if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) { if (strcmp(file, "(eval)") != 0) {
absolute_path = rb_str_new_cstr(file);
}
else if (bind->path != Qnil) {
file = RSTRING_PTR(bind->path); file = RSTRING_PTR(bind->path);
line = bind->first_lineno; line = bind->first_lineno;
absolute_path = rb_current_realfilepath(); absolute_path = rb_current_realfilepath();