diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2018-08-19 23:40:44 -0700 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-03-10 17:47:39 +0100 |
commit | 143f900ab4fd89b2e87f2ca2eb9456dac182f855 (patch) | |
tree | 9882d2b84501320cc21e25d8a21f78689e8a175f /lib/bundler/stub_specification.rb | |
parent | 24ede701b16b98b3a9e7e0fc4684668508732a3b (diff) | |
download | bundler-143f900ab4fd89b2e87f2ca2eb9456dac182f855.tar.gz |
[StubSpecification] Comment why we override #stub
Diffstat (limited to 'lib/bundler/stub_specification.rb')
-rw-r--r-- | lib/bundler/stub_specification.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb index 08b7507d86..deaa7905c9 100644 --- a/lib/bundler/stub_specification.rb +++ b/lib/bundler/stub_specification.rb @@ -77,8 +77,13 @@ module Bundler stub.raw_require_paths end + # @note + # Cannot be an attr_reader that returns @stub, because the stub can pull it's `to_spec` + # from `Gem.loaded_specs`, which can end up being self. + # #_remote_specification has logic to handle this case, so delegate to that in that situation, + # because otherwise we can end up with a stack overflow when calling #missing_extensions? def stub - if !@_remote_specification && @stub.instance_variable_get(:@data) && Gem.loaded_specs[name].equal?(self) + if @_remote_specification.nil? && @stub.instance_variable_get(:@data) && Gem.loaded_specs[name].equal?(self) _remote_specification end @stub |