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

SCons: Ensure with statement where applicable #89361

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Mar 10, 2024

There are a handful of instances in the repo where a file is opened but never explicitly closed. Though this could've simply been a PR ensuring that there's a respective "close" function for all of these, the better option appeared to be applying the with statement's wrapping capabilities across the repo. This keyword was added in Python 3.6, and while most new code seems to utilize it, legacy code was never fully updated to support it after the minimum version was increased from 3.5. No significant code changes were made, beyond minor refactoring for fringe situations (eg: consolidating mutually exlusive open calls behind if/else into a single call)

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Mar 10, 2024
Copy link
Contributor

@Riteo Riteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Yes! Let modern Python Prevail!

@Riteo
Copy link
Contributor

Riteo commented Mar 10, 2024

Pro tip for anyone else wanting to review this PR: in the diff page, if you click the gear icon you can tick the "hide whitespace" option. This, way, this 1.6K diff becomes like 100 lines long or something.

@akien-mga akien-mga merged commit 53701a0 into godotengine:master Mar 10, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@Repiteo Repiteo deleted the scons/with-statement branch March 10, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants