Skip to content

Commit ce91590

Browse files
committed
Ignore internal frames in RubyGems' Kernel#warn
* See #2046
1 parent 83d5b02 commit ce91590

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/mri/rubygems/core_ext/kernel_warn.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
if RUBY_VERSION >= "2.5"
55

66
module Kernel
7-
path = "#{__dir__}/" # Frames to be skipped start with this path.
7+
rubygems_path = "#{__dir__}/" # Frames to be skipped start with this path.
88

99
# Suppress "method redefined" warning
1010
original_warn = instance_method(:warn)
@@ -32,7 +32,8 @@ module Kernel
3232

3333
start += 1
3434

35-
unless loc.path.start_with?(path)
35+
path = loc.path
36+
unless path.start_with?(rubygems_path) or path.start_with?('<internal:')
3637
# Non-rubygems frames
3738
uplevel -= 1
3839
end

0 commit comments

Comments
 (0)