mercurial/extensions.py
changeset 38344 c6f82a18a63d
parent 38343 2c1d983872f6
child 38727 fcb517ff9562
--- a/mercurial/extensions.py	Sun Jun 17 17:59:12 2018 +0900
+++ b/mercurial/extensions.py	Sun Jun 17 18:01:49 2018 +0900
@@ -605,12 +605,10 @@
 def _disabledhelp(path):
     '''retrieve help synopsis of a disabled extension (without importing)'''
     try:
-        file = open(path, 'rb')
+        with open(path, 'rb') as src:
+            doc = _moduledoc(src)
     except IOError:
         return
-    else:
-        doc = _moduledoc(file)
-        file.close()
 
     if doc: # extracting localized synopsis
         return gettext(doc)