Skip to content

Commit

Permalink
fix unclosed file warning (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckleemann authored Aug 27, 2021
1 parent 4da6a19 commit 9d1ecfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion prospector/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def read_py_file(filepath):
raise CouldNotHandleEncoding(filepath, err)

try:
return tokenize.open(filepath).read()
with tokenize.open(filepath) as f:
return f.read()
# this warning is issued:
# (1) if uft-8 is specified, but latin1 is used with something like \x0e9 appearing
# (see http://stackoverflow.com/a/5552623)
Expand Down

0 comments on commit 9d1ecfd

Please sign in to comment.