Skip to content
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

Fix a possible resource leak with with blocks #4347

Merged
merged 2 commits into from
Apr 28, 2023
Merged

Fix a possible resource leak with with blocks #4347

merged 2 commits into from
Apr 28, 2023

Conversation

SeanTAllen
Copy link
Member

Previously, with blocks would allow the usage of _ as a variable in the with parameters.

A _ variable isn't usable within the block itself and dispose wasn't called on the variable as it isn't valid to call any methods on the special _ variable.

The lack of dispose call on objects that might control resources could result in a resource leak.

We've addressed the issue by disallowing _ as a variable name in with parameters.

This is a breaking change, albeit one we don't expect to have any "real-world" impact.

Fixes #4345

@SeanTAllen SeanTAllen requested a review from a team April 25, 2023 21:31
@SeanTAllen SeanTAllen added the changelog - changed Automatically add "Changed" CHANGELOG entry on merge label Apr 25, 2023
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Apr 25, 2023
Previously, `with` blocks would allow the usage of `_` as a variable in
the `with` parameters.

A `_` variable isn't usable within the block itself and `dispose` wasn't
called on the variable as it isn't valid to call any methods on the special
`_` variable.

The lack of `dispose` call on objects that might control resources could
result in a resource leak.

We've addressed the issue by disallowing `_` as a variable name in `with`
parameters.

This is a breaking change, albeit one we don't expect to have any
"real-world" impact.

Fixes #4345
Co-authored-by: Joe Eli McIlvain <[email protected]>
@SeanTAllen SeanTAllen merged commit e98b6fd into main Apr 28, 2023
@SeanTAllen SeanTAllen deleted the 4345 branch April 28, 2023 19:02
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Apr 28, 2023
github-actions bot pushed a commit that referenced this pull request Apr 28, 2023
github-actions bot pushed a commit that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - changed Automatically add "Changed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With block doesn't call dispose on an object if its name is _
3 participants