diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-07 13:05:00 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-07 13:05:00 +0000 |
commit | a93a2f88d277b14818d0240ef48f2f2311933d2e (patch) | |
tree | e8f903fb0b7018930459161d4ae465f7f3c9d11e /test | |
parent | a3843824c455d0b0efcfc5af03cbcebaac090eda (diff) |
merge revision(s) 5931857281ce45c1c277aa86d1588119ab00a955,76e2370f132f83c16c9de39a0a9356579f364527: [Backport #16041]
Fix dangling path name from fstring
* parse.y (yycompile): make sure in advance that the `__FILE__`
object shares a fstring, to get rid of dangling path name.
Fixed up 53e9908d8afc7f03109b0aafd1698ab35f512b05. [Bug #16041]
* vm_eval.c (eval_make_iseq): ditto.
Fix dangling path name from fstring
* load.c (rb_require_internal): make sure in advance that the path
to be loaded shares a fstring, to get rid of dangling path name.
Fixed up 5931857281ce45c1c277aa86d1588119ab00a955. [Bug #16041]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_eval.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 8900b4f165..9cb69ddc37 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -497,6 +497,17 @@ class TestEval < Test::Unit::TestCase }, '[Bug #10368]' end + def test_gced_eval_location + Dir.mktmpdir do |d| + File.write("#{d}/2.rb", "") + File.write("#{d}/1.rb", "require_relative '2'\n""__FILE__\n") + file = "1.rb" + path = File.expand_path(file, d) + assert_equal(path, eval(File.read(path), nil, File.expand_path(file, d))) + assert_equal(path, eval(File.read(path), nil, File.expand_path(file, d))) + end + end + def orphan_proc proc {eval("return :ng")} end |