[rubygems/rubygems] Do not replace the cache entry if there is already one
* That way, multiple lookups for the same file always return the same object. https://github.com/rubygems/rubygems/commit/50a431b6db
This commit is contained in:
parent
2453d16f5e
commit
05ae2c11fa
@ -1124,8 +1124,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|||||||
if Gem::Specification === _spec
|
if Gem::Specification === _spec
|
||||||
_spec.loaded_from = File.expand_path file.to_s
|
_spec.loaded_from = File.expand_path file.to_s
|
||||||
LOAD_CACHE_MUTEX.synchronize do
|
LOAD_CACHE_MUTEX.synchronize do
|
||||||
|
prev = LOAD_CACHE[file]
|
||||||
|
if prev
|
||||||
|
_spec = prev
|
||||||
|
else
|
||||||
LOAD_CACHE[file] = _spec
|
LOAD_CACHE[file] = _spec
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return _spec
|
return _spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user