mirror of https://github.com/rails/rails
Merge pull request #52099 from justinko/issue-52089
Do not use SyntaxError#path
This commit is contained in:
commit
ba60af6c41
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue