-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Block doesn't retain it's binding through instance_eval #4478
Comments
Yep, this is a bug. I've long known our This should be fixable by cloning more of the block. This will impact the performance of instance_eval (more to clone, more to clean up) but we may be able to do it only for blocks that have been reified into procs (since literal blocks are only alive for the duration of the instance_eval call). |
FWIW this is a much better repro than we usually get. We appreciate the extra effort to narrow this down. |
Ahh boo, I pushed #4485 for this but forgot to tag this issue. If it looks ok I'll re-commit that change. |
Ugh, and #4485 was not even for this bug. Nevermind. |
Oops. |
Well I'm not sure if it was 55b3080, but this appears to be fixed on master.
|
Environment
Expected Behavior
I expect this code to return 'Extender' 2 times, in the same manner as MRI does.
Actual Behavior
For some reason, after instance_eval a passed block looses it's binding, and becomes bound to the object it was instance_eval-ed. So the actual result is
Sorry, probably I could come up with a simpler example. I've just roughly cropped my real application to the smallest possible size.
The text was updated successfully, but these errors were encountered: