diff --git a/ext/psych/lib/psych/visitors/visitor.rb b/ext/psych/lib/psych/visitors/visitor.rb index 35f8f81f18446f..e2585c0c774624 100644 --- a/ext/psych/lib/psych/visitors/visitor.rb +++ b/ext/psych/lib/psych/visitors/visitor.rb @@ -12,7 +12,7 @@ def accept target def self.dispatch_cache Hash.new do |hash, klass| hash[klass] = :"visit_#{klass.name.gsub('::', '_')}" - end + end.compare_by_identity end if defined?(Ractor) diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 986c57be70309c..ac6777aeb5d838 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -80,7 +80,7 @@ def initialize emitter, ss, options raise(TypeError, "Can't dump #{target.class}") unless method h[klass] = method - end + end.compare_by_identity end def start encoding = Nodes::Stream::UTF8 diff --git a/test/psych/test_ractor.rb b/test/psych/test_ractor.rb index 90e40360c02633..2f8d5ca18de78b 100644 --- a/test/psych/test_ractor.rb +++ b/test/psych/test_ractor.rb @@ -24,6 +24,9 @@ def test_not_shareable end def test_ractor_config + # Config is ractor-local + # Test is to make sure it works, even though usage is probably very low. + # The methods are not documented and might be deprecated one day assert_ractor(<<~RUBY, require_relative: 'helper') r = Ractor.new do Psych.add_builtin_type 'omap' do |type, val|