summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/visitors
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-10-18 12:34:59 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-12 10:35:47 +0900
commit30fdee65d96924e0793ec702fcda909a2cac71ea (patch)
tree9f92bbd2e5db5fc62fc85a5459de678eb66f56ae /ext/psych/lib/psych/visitors
parent5ef41c91f0a1bca1617aaa4367ccf8e32c04b2d9 (diff)
[ruby/psych] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. I'm not sure if the untaint calls in deduplicate are still needed after the removal of tainting in the parser. If they are not needed, they should be removed. https://github.com/ruby/psych/commit/73c1a2b4e0
Diffstat (limited to 'ext/psych/lib/psych/visitors')
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index 49447e124a..b72fb4a1dc 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -368,11 +368,9 @@ module Psych
hash
end
- if String.method_defined?(:-@)
+ if RUBY_VERSION < '2.7'
def deduplicate key
if key.is_a?(String)
- # It is important to untaint the string, otherwise it won't
- # be deduplicated into and fstring, but simply frozen.
-(key.untaint)
else
key
@@ -381,9 +379,7 @@ module Psych
else
def deduplicate key
if key.is_a?(String)
- # Deduplication is not supported by this implementation,
- # but we emulate it's side effects
- key.untaint.freeze
+ -key
else
key
end