Project

General

Profile

Actions

Feature #12944

closed

Change Kernel#warn to call Warning.warn

Added by jeremyevans0 (Jeremy Evans) over 7 years ago. Updated almost 7 years ago.

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

Description

Currently, Kernel#warn is basically the same as $stderr.puts. With the new Warning.warn support in ruby 2.4, it makes sense for Kernel#warn to call Warning.warn, otherwise you will not be able to use Warning.warn to filter/process warning messages generated by Kernel#warn.

The Kernel#warn API is different than the Warning.warn API, the attached patch tries to get similar behavior, but there are probably corner cases where the behavior is different.


Files

0001-Change-Kernel-warn-to-call-Warning.warn.patch (1.88 KB) 0001-Change-Kernel-warn-to-call-Warning.warn.patch jeremyevans0 (Jeremy Evans), 11/15/2016 08:13 PM
0001-Change-Kernel-warn-to-call-Warning.warn.patch (1.89 KB) 0001-Change-Kernel-warn-to-call-Warning.warn.patch jeremyevans0 (Jeremy Evans), 11/26/2016 03:55 AM
0001-Change-Kernel-warn-to-call-Warning.warn.patch (2.36 KB) 0001-Change-Kernel-warn-to-call-Warning.warn.patch jeremyevans0 (Jeremy Evans), 11/26/2016 07:46 AM
0001-Change-Kernel-warn-to-call-Warning.warn.patch (2.3 KB) 0001-Change-Kernel-warn-to-call-Warning.warn.patch Use rb_ary_join jeremyevans0 (Jeremy Evans), 12/13/2016 04:23 PM
0001-Change-Kernel-warn-to-call-Warning.warn.patch (3.23 KB) 0001-Change-Kernel-warn-to-call-Warning.warn.patch flatten array, append newlines to each line, then join jeremyevans0 (Jeremy Evans), 12/14/2016 03:40 PM
0001-Restore-behavior-of-Kernel-warn-accepting-arrays-arg.patch (1.23 KB) 0001-Restore-behavior-of-Kernel-warn-accepting-arrays-arg.patch Eregon (Benoit Daloze), 04/25/2017 12:06 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #14006: 2.5.0preview1でWarning.warnを再定義するとSystemStackErrorが発生する ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0