[前][次][番号順一覧][スレッド一覧]

ruby-changes:56708

From: Benoit <ko1@a...>
Date: Wed, 31 Jul 2019 09:15:05 +0900 (JST)
Subject: [ruby-changes:56708] Benoit Daloze: 05ae2c11fa (master): [rubygems/rubygems] Do not replace the cache entry if there is already one

https://git.ruby-lang.org/ruby.git/commit/?id=05ae2c11fa

From 05ae2c11fa0464b258d40ff330839a303fbdfd67 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Thu, 6 Jun 2019 15:54:17 +0200
Subject: [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

diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index abb6e0e..3c82487 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1124,7 +1124,12 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1124
       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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]