diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-05 11:52:14 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-01-08 08:09:34 +0000 |
| commit | 55aa1a206c676c9e1c9163534cd7ca798c6d8353 (patch) | |
| tree | cba93b140a7cb8be5bde5fe2d11de53329c7be41 /lib | |
| parent | 1a1b653c9c7f83599cb6df0c0d4f0332f466c5f6 (diff) | |
[rubygems/rubygems] `LoadError#path` on the caught exception does not need to protect
https://github.com/rubygems/rubygems/commit/a31f5d1a18
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rubygems/core_ext/kernel_require.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index c53afe34d9..b92d6f9965 100644 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -147,17 +147,17 @@ module Kernel RUBYGEMS_ACTIVATION_MONITOR.exit return gem_original_require(path) rescue LoadError => load_error - RUBYGEMS_ACTIVATION_MONITOR.enter + if load_error.path == path + RUBYGEMS_ACTIVATION_MONITOR.enter - begin - if load_error.path == path and Gem.try_activate(path) - require_again = true + begin + require_again = Gem.try_activate(path) + ensure + RUBYGEMS_ACTIVATION_MONITOR.exit end - ensure - RUBYGEMS_ACTIVATION_MONITOR.exit - end - return gem_original_require(path) if require_again + return gem_original_require(path) if require_again + end raise load_error ensure |
