Project

General

Profile

Actions

Bug #14229

closed

An exception in eval has strange message

Added by mame (Yusuke Endoh) almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Target version:
[ruby-core:84434]

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

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #12338: bypass Exception.newClosedActions

Updated by shevegen (Robert A. Heiler) almost 7 years ago

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?

Actions #2

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Target version deleted (2.6)

Updated by phluid61 (Matthew Kerwin) almost 7 years ago

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

Updated by mame (Yusuke Endoh) almost 7 years ago

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.

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • 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.

Actions #6

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

Actions #8

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0