diff options
author | Hiroshi SHIBATA <[email protected]> | 2024-08-08 13:00:35 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2024-08-08 13:24:27 +0900 |
commit | fa443699afe888d1b0d1f586e97700527a23e5fa (patch) | |
tree | fcbbd61536eb4dd4d84a9f2f30b3a65651f386ff | |
parent | 3da7e440e9fca835f5475a98f1c0afb4d2ac71db (diff) |
Partly reverted 09638741ba4d9547a0e48af8c767744fb1d7f68d
This change didn't work with Ruby 3.3.
We should revert this to test bundled_gems.rb with Ruby 3.3.
-rw-r--r-- | lib/bundled_gems.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 476750572a..b14e9276fb 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -155,8 +155,18 @@ module Gem::BUNDLED_GEMS # Additionally, we need to skip Bootsnap and Zeitwerk if present, these # gems decorate Kernel#require, so they are not really the ones issuing # the require call users should be warned about. Those are upwards. - location = Thread.each_caller_location(2) do |cl| - break cl.path unless cl.base_label == "require" + frames_to_skip = 2 + location = nil + Thread.each_caller_location do |cl| + if frames_to_skip >= 1 + frames_to_skip -= 1 + next + end + + if cl.base_label != "require" + location = cl.path + break + end end if location && File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR) |