summaryrefslogtreecommitdiff
path: root/Lib/dbm/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/dbm/__init__.py')
-rw-r--r--Lib/dbm/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py
index 5f4664a7c6..6831a84407 100644
--- a/Lib/dbm/__init__.py
+++ b/Lib/dbm/__init__.py
@@ -153,9 +153,9 @@ def whichdb(filename):
except OSError:
return None
- # Read the start of the file -- the magic number
- s16 = f.read(16)
- f.close()
+ with f:
+ # Read the start of the file -- the magic number
+ s16 = f.read(16)
s = s16[0:4]
# Return "" if not at least 4 bytes