mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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
1 changed files with 6 additions and 1 deletions
|
@ -1124,7 +1124,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
if Gem::Specification === _spec
|
||||
_spec.loaded_from = File.expand_path file.to_s
|
||||
LOAD_CACHE_MUTEX.synchronize do
|
||||
LOAD_CACHE[file] = _spec
|
||||
prev = LOAD_CACHE[file]
|
||||
if prev
|
||||
_spec = prev
|
||||
else
|
||||
LOAD_CACHE[file] = _spec
|
||||
end
|
||||
end
|
||||
return _spec
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue