Bug #14229
closed
An exception in eval has strange message
Added by mame (Yusuke Endoh) almost 7 years ago.
Updated almost 7 years ago.
Description
Is this intentional? If so, I'm curious what purpose it is for.
begin
eval("raise")
rescue
p e.message #=> "(eval):1:in `<main>'"
end
This leads to progressive backtrace message:
$ ./miniruby -e 'eval("raise")'
Traceback (most recent call last):
2: from -e:1:in `<main>'
1: from -e:1:in `eval'
-e:1:in `eval': (eval):1:in `<main>' (RuntimeError)
^^^^^^^^^^^^^^^^^^^^ HIGHLIGHTED
Is this only with miniruby?
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.
The e.message part confuses me, was this part of a larger code
snippet?
- Target version deleted (
2.6)
shevegen (Robert A. Heiler) wrote:
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.
The e.message part confuses me, was this part of a larger code
snippet?
begin
eval("raise")
rescue => e
p e.message
end
phluid61 (Matthew Kerwin) wrote:
shevegen (Robert A. Heiler) wrote:
I get "undefined local variable or method `e' for main:Object"
for a newly created "test.rb" file.
Sorry it was buggy. phluid61 is correct.
- Target version set to 2.6
I think I've filed this issue already (and discussed at a developers' meeting), but I can't remember the number.
- Status changed from Assigned to Closed
Applied in changeset trunk|r61482.
vm_eval.c: strange message in eval
- vm_eval.c (eval_string_with_cref): remove unnecessary location
from exception backtrace in eval.
[ruby-core:84434] [Bug #14229]
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0