Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix taint warnings on Ruby master #113

Merged
merged 1 commit into from Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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