Created
November 12, 2019 06:45
-
-
Save hsbt/46dca58367ee37b68ca3bfcaa9f75815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 0cf884df64c307d4c9322e1ad7eb28f9e8efec31 (HEAD -> backport-ruby-core) | |
Author: Hiroshi SHIBATA <[email protected]> | |
Date: 2019-11-12 15:44:19 +0900 | |
Only enabled mon_owned condition with Ruby 2.5+ | |
diff --git lib/rubygems/core_ext/kernel_require.rb lib/rubygems/core_ext/kernel_require.rb | |
index d2bcc508e5..0be5172040 100644 | |
--- lib/rubygems/core_ext/kernel_require.rb | |
+++ lib/rubygems/core_ext/kernel_require.rb | |
@@ -32,7 +32,9 @@ module Kernel | |
# that file has already been loaded is preserved. | |
def require(path) | |
- monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned? | |
+ if RUBY_PLATFORM >= '2.5' | |
+ monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned? | |
+ end | |
RUBYGEMS_ACTIVATION_MONITOR.enter | |
path = path.to_path if path.respond_to? :to_path | |
@@ -167,9 +169,11 @@ module Kernel | |
raise load_error | |
ensure | |
- if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?) | |
- STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $! | |
- raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}" | |
+ if RUBY_VERSION >= "2.5" | |
+ if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?) | |
+ STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $! | |
+ raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}" | |
+ end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment