ruby-changes:62469
From: Jeremy <ko1@a...>
Date: Fri, 31 Jul 2020 21:08:39 +0900 (JST)
Subject: [ruby-changes:62469] 1a935606b5 (master): [rubygems/rubygems] Fix Kernel#warn override to handle backtrace location with nil path
https://git.ruby-lang.org/ruby.git/commit/?id=1a935606b5 From 1a935606b5e307375ce9d4215a46da2ca91dc1d6 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Fri, 24 Jul 2020 08:09:50 -0700 Subject: [rubygems/rubygems] Fix Kernel#warn override to handle backtrace location with nil path It's very unlikely to hit this case, but it is possible, as Thread::Backtrace::Location#path can return nil if the location is a cfunc with no previous iseq. See location_path in vm_backtrace.c in Ruby. https://github.com/rubygems/rubygems/commit/511935645a diff --git a/lib/rubygems/core_ext/kernel_warn.rb b/lib/rubygems/core_ext/kernel_warn.rb index e10a845..e030ef8 100644 --- a/lib/rubygems/core_ext/kernel_warn.rb +++ b/lib/rubygems/core_ext/kernel_warn.rb @@ -38,10 +38,11 @@ if RUBY_VERSION >= "2.5" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_warn.rb#L38 start += 1 - path = loc.path - unless path.start_with?(rubygems_path) or path.start_with?('<internal:') - # Non-rubygems frames - uplevel -= 1 + if path = loc.path + unless path.start_with?(rubygems_path) or path.start_with?('<internal:') + # Non-rubygems frames + uplevel -= 1 + end end end uplevel = start -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/