Merge pull request #52099 from justinko/issue-52089

Do not use SyntaxError#path
This commit is contained in:
Rafael Mendonça França 2024-06-12 15:03:19 -04:00 committed by GitHub
commit ba60af6c41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 11 deletions

View File

@ -45,7 +45,7 @@ module ActiveSupport
private
def parse_message_for_trace
if source_location_eval?
if __getobj__.to_s.start_with?("(eval")
# If the exception is coming from a call to eval, we need to keep
# the path of the file in which eval was called to ensure we can
# return the right source fragment to show the location of the
@ -56,15 +56,5 @@ module ActiveSupport
__getobj__.to_s.split("\n")
end
end
if SyntaxError.method_defined?(:path) # Ruby 3.3+
def source_location_eval?
__getobj__.path.start_with?("(eval")
end
else # 3.2 and older versions of Ruby
def source_location_eval?
__getobj__.to_s.start_with?("(eval")
end
end
end
end