Issue #17466 has been updated by marcandre (Marc-Andre Lafortune).

Assignee set to aycabta (aycabta .)

The order of the backtrace was reverse for 2.7 and switched back for 3.0, see #8661

Indeed, `irb` probably needs to be updated to reflect that.


----------------------------------------
Bug #17466: Inconsistent backtrace order in Ruby 3.0
https://bugs.ruby-lang.org/issues/17466#change-89486

* Author: jnchito (Junichi Ito)
* Status: Open
* Priority: Normal
* Assignee: aycabta (aycabta .)
* ruby -v: ruby 3.0.0dev (2020-12-19T22:13:08Z master 6343a81129) [x86_64-darwin20]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
I found the backtrace order is different between `ruby sample.rb` and irb in Ruby 3.0.

```ruby
# sample.rb
puts RUBY_DESCRIPTION
class A
  def hoge
    fuga
  end

  def fuga
    1/0
  end
end
A.new.hoge
```

```
$ ruby sample.rb
ruby 3.0.0dev (2020-12-19T22:13:08Z master 6343a81129) [x86_64-darwin20]
sample.rb:8:in `/': divided by 0 (ZeroDivisionError)
	from sample.rb:8:in `fuga'
	from sample.rb:4:in `hoge'
	from sample.rb:11:in `<main>'
```

```
$ irb --prompt simple
>> puts RUBY_DESCRIPTION
ruby 3.0.0dev (2020-12-19T22:13:08Z master 6343a81129) [x86_64-darwin20]
=> nil
?> class A
?>   def hoge
?>     fuga
?>   end
?> 
?>   def fuga
?>     1/0
?>   end
>> end
=> :fuga
>> A.new.hoge
Traceback (most recent call last):
        7: from /Users/jnito/.rbenv/versions/3.0.0-dev/bin/irb:23:in `<main>'
        6: from /Users/jnito/.rbenv/versions/3.0.0-dev/bin/irb:23:in `load'
        5: from /Users/jnito/.rbenv/versions/3.0.0-dev/lib/ruby/gems/3.0.0/gems/irb-1.2.7/exe/irb:11:in `<top (required)>'
        4: from (irb):11:in `<main>'
        3: from (irb):4:in `hoge'
        2: from (irb):8:in `fuga'
        1: from (irb):8:in `/'
ZeroDivisionError (divided by 0)
```

I'd like to have the same order because such an inconsistent results would confuse developers (especially beginners).

This issue is related to https://bugs.ruby-lang.org/issues/8661

---Files--------------------------------
Screen Shot 2020-12-24 at 8.38.53.png (992 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>