From c6837638657429034825d5c9e2a29c340898afb8 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sat, 3 Aug 2019 07:44:44 +0900 Subject: Use source_location instead of eval(__FILE__,binding) in Binding#irb e9e17cbc051e894dfd27eda5feca2939f65552db (enabling the warning by default) caused a warning in test-spec: ``` /data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/irb_spec.rb Binding#irb - creates an IRB session with the binding in scope/data/chkbuild/tmp/build/20190802T213005Z/ruby/spec/ruby/core/binding/fixtures/irb.rb:3: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead ``` https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190802T213005Z.log.html.gz ref: [Bug #4352] --- lib/irb.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/irb.rb b/lib/irb.rb index f9c27782b9..a08aa874c9 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -805,7 +805,7 @@ class Binding # # See IRB@IRB+Usage for more information. def irb - IRB.setup(eval("__FILE__"), argv: []) + IRB.setup(source_location[0], argv: []) workspace = IRB::WorkSpace.new(self) STDOUT.print(workspace.code_around_binding) IRB::Irb.new(workspace).run(IRB.conf) -- cgit v1.2.3