summaryrefslogtreecommitdiff
path: root/lib/bundler/stub_specification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/stub_specification.rb')
-rw-r--r--lib/bundler/stub_specification.rb7
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