summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--test/ruby/test_method.rb1
-rw-r--r--version.h2
-rw-r--r--vm_eval.c9
4 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d4c13f5582..c9e0c0a323 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Mar 31 00:15:45 2014 Shota Fukumori <her@sorah.jp>
+
+ * vm_eval.c (eval_string_with_cref): Unify to use NIL_P.
+
+Mon Mar 31 00:15:45 2014 Shota Fukumori <her@sorah.jp>
+
+ * vm_eval.c (eval_string_with_cref): Use file path even if scope is
+ given. Related to [ruby-core:56099] [Bug #8662] and r42103.
+
Mon Mar 31 00:02:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (yycompile): store file name as String to keep the encoding.
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index f44f7e5bdb..7522a30886 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -550,6 +550,7 @@ class TestMethod < Test::Unit::TestCase
assert_equal(__dir__, eval("__dir__", binding), bug8436)
bug8662 = '[ruby-core:56099] [Bug #8662]'
assert_equal("arbitrary", eval("__dir__", binding, "arbitrary/file.rb"), bug8662)
+ assert_equal("arbitrary", Object.new.instance_eval("__dir__", "arbitrary/file.rb"), bug8662)
end
def test_alias_owner
diff --git a/version.h b/version.h
index fb3fb916f1..5ab5ff9cc7 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-03-31"
-#define RUBY_PATCHLEVEL 464
+#define RUBY_PATCHLEVEL 465
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 3
diff --git a/vm_eval.c b/vm_eval.c
index 6095e1d84c..b5842137ea 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1194,14 +1194,15 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, volatile V
VALUE absolute_path = Qnil;
VALUE fname;
+ if (file != Qundef) {
+ absolute_path = file;
+ }
+
if (scope != Qnil) {
if (rb_obj_is_kind_of(scope, rb_cBinding)) {
GetBindingPtr(scope, bind);
envval = bind->env;
- if (file != Qundef) {
- absolute_path = file;
- }
- else if (!NIL_P(bind->path)) {
+ if (NIL_P(absolute_path) && !NIL_P(bind->path)) {
file = bind->path;
line = bind->first_lineno;
absolute_path = rb_current_realfilepath();