diff options
| author | Mickaël Schoentgen <contact@tiger-222.fr> | 2018-11-01 17:28:20 +0100 |
|---|---|---|
| committer | Mickaël Schoentgen <contact@tiger-222.fr> | 2018-11-09 10:29:21 +0100 |
| commit | d406e718d7ef23c2cb83bb38bc156f3cccffcf6f (patch) | |
| tree | 4070d0fa86037b0269c8dac79d1e7a8f27a2e060 /example/BASIC/basiclog.py | |
| parent | 0f398b72618c1564d71f7dc0558e6722b241875a (diff) | |
| download | ply-d406e718d7ef23c2cb83bb38bc156f3cccffcf6f.tar.gz | |
Fix several ResourceWarning: unclosed file
Diffstat (limited to 'example/BASIC/basiclog.py')
| -rw-r--r-- | example/BASIC/basiclog.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/example/BASIC/basiclog.py b/example/BASIC/basiclog.py index 9dcc7fe..9258e29 100644 --- a/example/BASIC/basiclog.py +++ b/example/BASIC/basiclog.py @@ -23,7 +23,8 @@ import basinterp # If a runtime error occurs, we bail out and enter # interactive mode below if len(sys.argv) == 2: - data = open(sys.argv[1]).read() + with open(sys.argv[1]) as f: + data = f.read() prog = basparse.parse(data, debug=log) if not prog: raise SystemExit |
