summaryrefslogtreecommitdiff
path: root/lib/rubygems/core_ext
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-07-24 08:09:50 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-07-31 21:07:19 +0900
commit1a935606b5e307375ce9d4215a46da2ca91dc1d6 (patch)
tree902d7cdddb5650724d56c9a4f2ad9108cbc3a576 /lib/rubygems/core_ext
parent331fe6a88f96d9f986da55e003e896c2bc181db0 (diff)
[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
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3379
Diffstat (limited to 'lib/rubygems/core_ext')
-rw-r--r--lib/rubygems/core_ext/kernel_warn.rb9
1 files changed, 5 insertions, 4 deletions
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"
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