Skip to content

Commit e63d45a

Browse files
committed
merge revision(s) 40759,40966,41305,41306: [Backport ruby#8436]
vm_eval.c: suppress warning * vm_eval.c (eval_string_with_cref): narrow a variable scope into the EXEC_TAG block to suppress -Wclobberd warning. * vm_eval.c (eval_string_with_cref): propagate absolute path from the binding if it is given explicitly. patch by Gat (Dawid Janczak) at [ruby-core:55123]. [Bug ruby#8436] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 3190cb8 commit e63d45a

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Sun Jun 16 00:30:56 2013 Nobuyoshi Nakada <[email protected]>
2+
3+
* vm_eval.c (eval_string_with_cref): propagate absolute path from the
4+
binding if it is given explicitly. patch by Gat (Dawid Janczak) at
5+
[ruby-core:55123]. [Bug #8436]
6+
17
Wed Jun 12 23:41:21 2013 NARUSE, Yui <[email protected]>
28

39
* vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.

test/ruby/test_method.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,9 @@ def initialize(target)
505505

506506
def test___dir__
507507
assert_instance_of String, __dir__
508-
assert_equal(File.dirname(__FILE__), __dir__)
508+
assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
509+
bug8436 = '[ruby-core:55123] [Bug #8436]'
510+
assert_equal(__dir__, eval("__dir__", binding), bug8436)
509511
end
510512

511513
def test_alias_owner

version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#define RUBY_VERSION "2.0.0"
2-
#define RUBY_RELEASE_DATE "2013-06-13"
3-
#define RUBY_PATCHLEVEL 216
2+
#define RUBY_RELEASE_DATE "2013-06-16"
3+
#define RUBY_PATCHLEVEL 217
44

55
#define RUBY_RELEASE_YEAR 2013
66
#define RUBY_RELEASE_MONTH 6
7-
#define RUBY_RELEASE_DAY 13
7+
#define RUBY_RELEASE_DAY 16
88

99
#include "ruby/version.h"
1010

vm_eval.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
11571157
int state;
11581158
VALUE result = Qundef;
11591159
VALUE envval;
1160-
rb_binding_t *bind = 0;
1160+
VALUE absolute_path = Qnil;
11611161
rb_thread_t *th = GET_THREAD();
11621162
rb_env_t *env = NULL;
11631163
rb_block_t block, *base_block;
@@ -1173,6 +1173,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
11731173
mild_compile_error = th->mild_compile_error;
11741174
TH_PUSH_TAG(th);
11751175
if ((state = TH_EXEC_TAG()) == 0) {
1176+
rb_binding_t *bind = 0;
11761177
rb_iseq_t *iseq;
11771178
volatile VALUE iseqval;
11781179

@@ -1183,6 +1184,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
11831184
if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
11841185
file = RSTRING_PTR(bind->path);
11851186
line = bind->first_lineno;
1187+
absolute_path = rb_current_realfilepath();
11861188
}
11871189
}
11881190
else {
@@ -1210,7 +1212,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
12101212
/* make eval iseq */
12111213
th->parse_in_eval++;
12121214
th->mild_compile_error++;
1213-
iseqval = rb_iseq_compile_on_base(src, rb_str_new2(file), INT2FIX(line), base_block);
1215+
iseqval = rb_iseq_compile_with_option(src, rb_str_new2(file), absolute_path, INT2FIX(line), base_block, Qnil);
12141216
th->mild_compile_error--;
12151217
th->parse_in_eval--;
12161218

0 commit comments

Comments
 (0)