Skip to content

Tidy up Python file handlers #735

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

Merged
merged 1 commit into from
Dec 23, 2015
Merged

Tidy up Python file handlers #735

merged 1 commit into from
Dec 23, 2015

Conversation

alexwlchan
Copy link
Contributor

Rather than using f = open(path).read(), which leaves the file open
for an indeterminate period of time, switch to the with open(path) as f
idiom, which ensures the file is always closed correctly.

Rather than using `f = open(path).read()`, which leaves the file open
for an indeterminate period of time, switch to the `with open(path) as f`
idiom, which ensures the file is always closed correctly.
outFile.write("}\n")
outFile.flush()
os.fsync(outFile.fileno())
outFile.close
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder how this ever worked.

gribozavr added a commit that referenced this pull request Dec 23, 2015
@gribozavr gribozavr merged commit f002192 into swiftlang:master Dec 23, 2015
gribozavr added a commit that referenced this pull request Dec 23, 2015
Fix syntax error and double open introduced in #735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants