Skip to content

Commit 0c58ab2

Browse files
committed
Don't leave file handle open after opening file for reading
Resolves #49
1 parent cb6639a commit 0c58ab2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

trailing_spaces.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ def freeze_last_version(self, view):
443443
# For some reasons, the on_activated hook gets fired on a ghost document
444444
# from time to time.
445445
if file_name and not view.is_scratch() and isfile(file_name):
446-
on_disk = codecs.open(file_name, "r", "utf-8").read().splitlines()
446+
with codecs.open(file_name, "r", "utf-8") as f:
447+
on_disk = f.read().splitlines()
447448

448449

449450
# Public: Deletes the trailing spaces.

0 commit comments

Comments
 (0)