Project

General

Profile

Bug #14229

An exception in eval has strange message

Added by mame (Yusuke Endoh) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
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

Related to Ruby trunk - Feature #12338: bypass Exception.newOpenActions

Associated revisions

Revision 62a3e7a3
Added by nobu (Nobuyoshi Nakada) about 1 year ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61482
Added by nobu (Nobuyoshi Nakada) about 1 year ago

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]

Revision 61482
Added by nobu (Nobuyoshi Nakada) about 1 year ago

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]

History

Updated by shevegen (Robert A. Heiler) about 1 year 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?

#2

Updated by naruse (Yui NARUSE) about 1 year ago

  • Target version deleted (2.6)

Updated by phluid61 (Matthew Kerwin) about 1 year 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) about 1 year 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) about 1 year 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.

#6

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

#8

Updated by nobu (Nobuyoshi Nakada) about 1 year 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]

Also available in: Atom PDF