From 48a79cd4921e6f38facbea5fbb4b7ab6905a524d Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sun, 27 Jul 2025 16:19:50 +0200 Subject: [PATCH] [ruby/json] Improve deprecation warning location detection https://github.com/ruby/json/commit/132049bde2 --- ext/json/lib/json/common.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index 69e436f190..9a878cead9 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -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