[前][次][番号順一覧][スレッド一覧]

ruby-changes:59329

From: Nobuyoshi <ko1@a...>
Date: Thu, 19 Dec 2019 09:55:44 +0900 (JST)
Subject: [ruby-changes:59329] 7aa8a78674 (master): Manage deprecation warnings about keyword argument

https://git.ruby-lang.org/ruby.git/commit/?id=7aa8a78674

From 7aa8a786740fd84bd718b0c055f190b25a8f0277 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 17 Dec 2019 17:16:12 +0900
Subject: Manage deprecation warnings about keyword argument


diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index 56cd19d..c7cfe81 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1160,6 +1160,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L1160
 
   def capture_warning_warn
     verbose = $VERBOSE
+    deprecated = Warning[:deprecated]
     warning = []
 
     ::Warning.class_eval do
@@ -1172,11 +1173,13 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L1173
     end
 
     $VERBOSE = true
+    Warning[:deprecated] = true
     yield
 
     return warning
   ensure
     $VERBOSE = verbose
+    Warning[:deprecated] = deprecated
 
     ::Warning.class_eval do
       remove_method :warn
diff --git a/vm_args.c b/vm_args.c
index a9027e3..924af71 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -597,6 +597,8 @@ static st_table *caller_to_callees = 0; https://github.com/ruby/ruby/blob/trunk/vm_args.c#L597
 static VALUE
 rb_warn_check(const rb_execution_context_t * const ec, const rb_iseq_t *const iseq)
 {
+    if (!rb_warning_category_enabled_p(RB_WARN_CATEGORY_DEPRECATED)) return 1;
+
     if (!iseq) return 0;
 
     const st_data_t callee = (st_data_t)(iseq->body->iseq_unique_id * 2);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]