diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
index 524c560e2d323196ab778d9b22029e9af2f32c37_aGdleHQvY29udmVydC9tb25vdG9uZS5weQ==..64481eee621559cdc024722d11d215ed2f8cd23e_aGdleHQvY29udmVydC9tb25vdG9uZS5weQ== 100644
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -27,7 +27,9 @@
         if not os.path.exists(os.path.join(path, '_MTN')):
             # Could be a monotone repository (SQLite db file)
             try:
-                header = file(path, 'rb').read(16)
+                f = file(path, 'rb')
+                header = f.read(16)
+                f.close()
             except:
                 header = ''
             if header != 'SQLite format 3\x00':
diff --git a/hgext/inotify/linuxserver.py b/hgext/inotify/linuxserver.py
index 524c560e2d323196ab778d9b22029e9af2f32c37_aGdleHQvaW5vdGlmeS9saW51eHNlcnZlci5weQ==..64481eee621559cdc024722d11d215ed2f8cd23e_aGdleHQvaW5vdGlmeS9saW51eHNlcnZlci5weQ== 100644
--- a/hgext/inotify/linuxserver.py
+++ b/hgext/inotify/linuxserver.py
@@ -44,7 +44,7 @@
 def _explain_watch_limit(ui, dirstate, rootabs):
     path = '/proc/sys/fs/inotify/max_user_watches'
     try:
-        limit = int(file(path).read())
+        limit = int(util.readfile(path))
     except IOError, err:
         if err.errno != errno.ENOENT:
             raise