mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/json] Improve deprecation warning location detection
https://github.com/ruby/json/commit/132049bde2
This commit is contained in:
parent
d0020d58f4
commit
48a79cd492
@ -96,7 +96,7 @@ module JSON
|
||||
end
|
||||
|
||||
class << self
|
||||
def deprecation_warning(message, uplevel = 4) # :nodoc:
|
||||
def deprecation_warning(message, uplevel = 3) # :nodoc:
|
||||
gem_root = File.expand_path("../../../", __FILE__) + "/"
|
||||
caller_locations(uplevel, 10).each do |frame|
|
||||
if frame.path.nil? || frame.path.start_with?(gem_root) || frame.path.end_with?("/truffle/cext_ruby.rb", ".c")
|
||||
@ -107,9 +107,9 @@ module JSON
|
||||
end
|
||||
|
||||
if RUBY_VERSION >= "3.0"
|
||||
warn(message, uplevel: uplevel - 1, category: :deprecated)
|
||||
warn(message, uplevel: uplevel, category: :deprecated)
|
||||
else
|
||||
warn(message, uplevel: uplevel - 1)
|
||||
warn(message, uplevel: uplevel)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user