From: merch-redmine@... Date: 2019-08-02T15:11:14+00:00 Subject: [ruby-core:94112] [Ruby master Bug#4352] [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) Issue #4352 has been updated by jeremyevans0 (Jeremy Evans). mame (Yusuke Endoh) wrote: > @jeremyevans0 , thank you for reminding this issue. > > The warning is printed only on the verbose mode in 2.6. It would be good to enable the warning by default in 2.7. > I tentatively changed at e9e17cbc051e894dfd27eda5feca2939f65552db. How about applying your patch for 3.0? > If you think your patch should be applied soon, I'm not so strongly against it. @mame I think applying my patch for 3.0 is fine. I only suggested it for 2.7 because that is what the issue target was. ---------------------------------------- Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) https://bugs.ruby-lang.org/issues/4352#change-80354 * Author: quix (James M. Lawrence) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: Next Major * ruby -v: ruby 1.9.3dev (2011-02-01 trunk 30751) [i386-darwin9.8.0] * Backport: ---------------------------------------- =begin def ex_message begin yield rescue => e p e.message end end ex_message { eval('raise') } ex_message { eval('raise', binding) } eval('def f ; end') p method(:f).source_location eval('def g ; end', binding) p method(:g).source_location ---- Without patch: "(eval):1:in `block in
': " "" ["(eval)", 1] ["eval_test.rb", 14] With patch: "(eval):1:in `block in
': " "(eval):1:in `block in
': " ["(eval)", 1] ["(eval)", 1] Knowing the line of an error inside eval is useful. Passing a binding shouldn't discard that information. Present behavior is even wrong: there's no line 10 in this file. ---- eval %{ # .. code ... raise }, binding ---- Without patch: /Users/jlawrence/tmp/raiser.rb:10:in `
': unhandled exception from /Users/jlawrence/tmp/raiser.rb:7:in `eval' from /Users/jlawrence/tmp/raiser.rb:7:in `
' With patch: /Users/jlawrence/tmp/raiser.rb:7:in `eval': (eval):4:in `
': (RuntimeError) from /Users/jlawrence/tmp/raiser.rb:7:in `eval' from /Users/jlawrence/tmp/raiser.rb:7:in `
' =end ---Files-------------------------------- eval-binding-file-line-4352.patch (11 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: