Skip to content

Make IOBase a context manager #649

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
Mar 10, 2019

Conversation

jaroel
Copy link
Contributor

@jaroel jaroel commented Mar 10, 2019

This allows the following:

with open('README.md') as fp:
    fp.read()

This does not close the file, as there's no close method yet. See #547 .

Fixes #648

@jaroel jaroel changed the title Make open a context manager Make IOBase a context manager Mar 10, 2019
@codecov-io
Copy link

Codecov Report

Merging #649 into master will increase coverage by 0.05%.
The diff coverage is 42.1%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #649      +/-   ##
==========================================
+ Coverage   40.81%   40.86%   +0.05%     
==========================================
  Files          76       76              
  Lines       17345    17358      +13     
  Branches     4474     4484      +10     
==========================================
+ Hits         7079     7093      +14     
+ Misses       8366     8358       -8     
- Partials     1900     1907       +7
Impacted Files Coverage Δ
vm/src/stdlib/io.rs 29.58% <42.1%> (+2.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 010969f...8f6257b. Read the comment docs.

@rmliddle rmliddle merged commit f57d2e2 into RustPython:master Mar 10, 2019
@jaroel jaroel deleted the context-manager-open branch March 10, 2019 02:42
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.

Builtin IOBase should be a context manager
3 participants