ruby-changes:58750
From: Hiroshi <ko1@a...>
Date: Tue, 12 Nov 2019 19:53:41 +0900 (JST)
Subject: [ruby-changes:58750] f36a53d038 (master): Only enabled mon_owned condition with Ruby 2.5+
https://git.ruby-lang.org/ruby.git/commit/?id=f36a53d038 From f36a53d03821624d30b3e91a7a75307b06e3a03c Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Tue, 12 Nov 2019 15:44:19 +0900 Subject: Only enabled mon_owned condition with Ruby 2.5+ diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index d2bcc50..76165a6 100644 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -32,7 +32,9 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L32 # that file has already been loaded is preserved. def require(path) - monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned? + if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?) + 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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L169 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 RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?) + 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/