Merge RubyGems-3.3.15 and Bundler-2.3.15

This commit is contained in:
Hiroshi SHIBATA 2022-07-13 14:37:17 +09:00 committed by nagachika
parent d7862a5de4
commit b9f6a09bd2
40 changed files with 385 additions and 100 deletions

View file

@ -1270,7 +1270,14 @@ class Gem::Specification < Gem::BasicSpecification
def self._load(str)
Gem.load_yaml
array = Marshal.load str
array = begin
Marshal.load str
rescue ArgumentError => e
raise unless e.message.include?("YAML")
Object.const_set "YAML", Psych
Marshal.load str
end
spec = Gem::Specification.new
spec.instance_variable_set :@specification_version, array[1]
@ -1289,11 +1296,6 @@ class Gem::Specification < Gem::BasicSpecification
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
end
# Cleanup any Psych::PrivateType. They only show up for an old bug
# where nil => null, so just convert them to nil based on the type.
array.map! {|e| e.kind_of?(Psych::PrivateType) ? nil : e }
spec.instance_variable_set :@rubygems_version, array[0]
# spec version
spec.instance_variable_set :@name, array[2]