Project

General

Profile

Actions

Bug #17413

closed

--backtrace-limit: wrong level counter

Added by zverok (Victor Shepelev) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:101561]

Description

Having this test.rb:

def inner
  raise 'test'
end

def outer
  inner
end

outer

...one might observe the following:

$ ruby test.rb
test.rb:2:in `inner': test (RuntimeError)
	from test.rb:6:in `outer'
	from test.rb:9:in `<main>'

# Print me 0 levels (only the report):
$ ruby --backtrace-limit=0 test.rb
test.rb:2:in `inner': test (RuntimeError)
	 ... 3 levels...                  # <== Umm, which 3? I saw 2 there!

$ ruby --backtrace-limit=1 test.rb
test.rb:2:in `inner': test (RuntimeError)
	from test.rb:6:in `outer'
	 ... 2 levels...                  # <== Which 2?.. 

# So, the next increase of the limit will leave just 1 hidden, right?..

$ ruby --backtrace-limit=2 test.rb
test.rb:2:in `inner': test (RuntimeError)
	from test.rb:6:in `outer'
	from test.rb:9:in `<main>'

# Nope!

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #8661: Add option to print backtrace in reverse order (stack frames first and error last)Closedmatz (Yukihiro Matsumoto)Actions
Actions #1

Updated by mame (Yusuke Endoh) almost 4 years ago

  • Related to Feature #8661: Add option to print backtrace in reverse order (stack frames first and error last) added

Updated by mame (Yusuke Endoh) almost 4 years ago

Good catch! I will fix it soon. Thanks

Updated by mame (Yusuke Endoh) almost 4 years ago

  • Status changed from Open to Closed

Fixed at eee93bc9330cb069abb679a0a0d48a49b10f6a4e

Updated by zverok (Victor Shepelev) almost 4 years ago

@mame (Yusuke Endoh) Thanks for the quick fix, now it works as expected!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0