Skip to content

Commit

Permalink
Fix taint warnings on Ruby master
Browse files Browse the repository at this point in the history
`$VERBOSE = false` won't be worked since `rb_warning` is changed to
`rb_warn`.

Ref ruby/ruby#2856.
  • Loading branch information
kamipo committed Jan 28, 2020
1 parent a9e39c0 commit c7e69a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 3 additions & 7 deletions lib/tzinfo.rb
Expand Up @@ -8,13 +8,9 @@ module TZInfo
# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in
# 3.0. Add a refinement to either silence the warning, or supply the method if
# needed.
old_verbose = $VERBOSE
$VERBOSE = false
begin
o = Object.new
require_relative 'tzinfo/untaint_ext' if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || !o.taint.tainted?
ensure
$VERBOSE = old_verbose
o = Object.new
if [:taint, :untaint, :tainted?].none? {|m| o.respond_to?(m) } || RUBY_VERSION >= '2.7'
require_relative 'tzinfo/untaint_ext'
end

require_relative 'tzinfo/version'
Expand Down
8 changes: 2 additions & 6 deletions test/tzinfo-data2/tzinfo/data.rb
Expand Up @@ -6,12 +6,8 @@ module TZInfo
module Data
location = File.dirname(File.dirname(__FILE__))

old_verbose = $VERBOSE
$VERBOSE = false
begin
location.untaint if location.respond_to?(:untaint)
ensure
$VERBOSE = old_verbose
if location.respond_to?(:untaint) && RUBY_VERSION < '2.7'
location.untaint
end

# The directory containing the TZInfo::Data files.
Expand Down

0 comments on commit c7e69a6

Please sign in to comment.