-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Kernel#caller_locations (2.x) #1491
Conversation
For the 1.x - where the issue is the most pressing for us - I will try to open a backport PR. |
caller_locations
when availableThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this breaks backward-compatibility because your patch doesn't consider excluding files.
Thoughts?
I did think about this but didn't re-add the filtering, primarily because tests stay green. In practice everywhere it is used in Sinatra itself it is only the first caller location that gets used/preserved. Since Sinatra is now shadowing a Ruby builtin, there are 2 courses of action possible:
What would be your preference? IMO ending up in a situation where you override a kernel method is undesirable because these usually have quite subtle implementations |
Aa you said, our tests passed, but it doesn't mean that your change is safe for all public APIs. Actually your proposal has a important meaning for improving our ecosystem so I'd like to consider merging this change but it's not now. I'll go back to the change next week, and then I'm going to rethink the necessity and its history at that time. Btw, thanks for your contribution. |
@namusyaka Did you arrive at a decision by any chance? We are nearing a Rails 5 upgrade and also there is something that might have to happen on the bootsnap side. Should we monkeypatch in the meantime? |
Please monkey-patch at this time if necessary. |
FWIW, I just ran into this when using ActiveSupport's In Rails 6.1 ActiveSupport expects a |
@namusyaka can we move forward with this in v3.0? I think this would be a good reason to release a v3 along with other updates that have been sitting. |
@jkowens Is this planned to release anytime soon? |
0161ba7
to
d7ce092
Compare
@namusyaka @olleolleolle I think I'm good with merging this into the unstable branch for v3.0. Do you have any thoughts or concerns? |
Ruby 2.x+ has a built-in implementation of `caller_locations`, which differs slightly from the Sinatra implementation of the same. This removes the customized implementation in favor of the system one
51199c6
to
b3a85e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🏆 !
Yay! |
Ruby 2.x+ has a built-in implementation of `caller_locations`, which differs slightly from the Sinatra implementation of the same name. This removes the customized implementation in favor of the system one Co-authored-by: Jordan Owens <jkowens@gmail.com>
Ruby 2.+ includes a Kernel implementation of
caller_locations
. This implementation differs subtly from the one in Sinatra, causing breakage when another caller tries to usecaller_locations
. Specifically, this blows up with Bootsnap as noted in Shopify/bootsnap#183This means that it is impossible to correctly use Sinatra in some situations when a Sinatra application is mounted within a Rails project that uses Bootsnap - which is now the default.
This PR removes the hand-rolled implementation of
caller_locations
and instead exposes the Kernel one as a public method. Since Sinatra now mandates Ruby 2.+ there should be no compatibility problems.