Manage deprecation warnings about keyword argument

This commit is contained in:
Nobuyoshi Nakada 2019-12-17 17:16:12 +09:00
parent 9bf9de3d9d
commit 7aa8a78674
No known key found for this signature in database
GPG Key ID: 4BC7D6DF58D8DF60
2 changed files with 5 additions and 0 deletions

View File

@ -1160,6 +1160,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
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|
end
$VERBOSE = true
Warning[:deprecated] = true
yield
return warning
ensure
$VERBOSE = verbose
Warning[:deprecated] = deprecated
::Warning.class_eval do
remove_method :warn

View File

@ -597,6 +597,8 @@ static st_table *caller_to_callees = 0;
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);