Project

General

Profile

Bug #14262

ArgumentError (negative level (-1)) when `warn "test message", uplevel: -2`

Added by znz (Kazuhiro NISHIYAMA) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2017-12-30 trunk 61515) [x86_64-darwin16]
[ruby-core:84568]

Description

When uplevel: -2, error message says negative level (-1).
When uplevel: -1, no exception occur.
What is expected behavior?

% irb -r irb/completion --simple-prompt
>> warn("test", uplevel: -1)
(irb):1: warning: test
=> nil
>> warn("test", uplevel: -2)
Traceback (most recent call last):
        3: from bin/irb:11:in `<main>'
        2: from (irb):2
        1: from (irb):2:in `warn'
ArgumentError (negative level (-1))
>> warn("test", uplevel: 0)
(irb):3: warning: test
=> nil
>> warn("test", uplevel: 1)

Related issues

Related to Ruby master - Feature #12882: Add caller/file/line information to internal Kernel#warn callsClosedmatz (Yukihiro Matsumoto)Actions
#1

Updated by znz (Kazuhiro NISHIYAMA) over 2 years ago

  • Related to Feature #12882: Add caller/file/line information to internal Kernel#warn calls added
#2

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r61525.


error.c: negative uplevel

  • error.c (rb_warn_m): negative uplevel is not allowed. [ruby-core:84568] [Bug #14262]

Also available in: Atom PDF