Bug #4379

[patch] eval(s, b, "(eval)", n) discards location

Added by quix (James M. Lawrence) over 9 years ago. Updated over 3 years ago.

Target version:
ruby -v:
ruby 1.9.3dev (2011-02-08 trunk 30820) [i386-darwin9.8.0]


% ruby -e 'p eval("raise", nil, "(eval)", 999)'
-e:1:in eval': (eval):999:in': (RuntimeError)
from -e:1:in eval'
from -e:1:in

With binding, location is ignored.

% ruby -e 'p eval("raise", binding, "(eval)", 999)'
-e:1:in <main>': unhandled exception
from -e:1:in
from -e:1:in `'

source_location has a similar problem.

The patch also applies cleanly to 1.9.2.


test_eval_location.patch (762 Bytes) test_eval_location.patch quix (James M. Lawrence), 02/08/2011 03:19 AM
eval_location.patch (1.26 KB) eval_location.patch quix (James M. Lawrence), 02/08/2011 03:19 AM
better_eval_location.patch (1.27 KB) better_eval_location.patch Slightly nicer version of eval_location.patch quix (James M. Lawrence), 02/08/2011 05:23 AM
final_eval_location.patch (4.11 KB) final_eval_location.patch This passes rubyspec while the above does not. Ensures __FILE__ == eval("__FILE__", binding) quix (James M. Lawrence), 02/09/2011 06:57 AM

Related issues

Related to Ruby master - Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s)Closedmatz (Yukihiro Matsumoto)Actions

Updated by naruse (Yui NARUSE) over 9 years ago

  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)

Matz, how do you think, 1.8's result is:

% ruby -ve 'p eval("raise", binding, "(eval)", 999)'
ruby 1.8.7 (2010-08-16 patchlevel 302) [amd64-freebsd8]
-e:1:in `eval': (eval):999: (RuntimeError)
from -e:1

Updated by ko1 (Koichi Sasada) about 8 years ago

  • Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada)

Updated by ko1 (Koichi Sasada) almost 8 years ago

  • Target version changed from 2.0.0 to 2.6

Are there any applications that this problem is critical for?

Updated by ko1 (Koichi Sasada) over 3 years ago

  • Status changed from Assigned to Closed

No feedback.

Also available in: Atom PDF