Skip to content

Commit 07325dc

Browse files
committed
Do not use SyntaxError#path
Fixes rails#52089
1 parent 2ebb508 commit 07325dc

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

activesupport/lib/active_support/syntax_error_proxy.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def backtrace_locations
4545

4646
private
4747
def parse_message_for_trace
48-
if source_location_eval?
48+
if __getobj__.to_s.start_with?("(eval")
4949
# If the exception is coming from a call to eval, we need to keep
5050
# the path of the file in which eval was called to ensure we can
5151
# return the right source fragment to show the location of the
@@ -56,15 +56,5 @@ def parse_message_for_trace
5656
__getobj__.to_s.split("\n")
5757
end
5858
end
59-
60-
if SyntaxError.method_defined?(:path) # Ruby 3.3+
61-
def source_location_eval?
62-
__getobj__.path.start_with?("(eval")
63-
end
64-
else # 3.2 and older versions of Ruby
65-
def source_location_eval?
66-
__getobj__.to_s.start_with?("(eval")
67-
end
68-
end
6959
end
7060
end

0 commit comments

Comments
 (0)