# HG changeset patch # User Yuya Nishihara # Date 2018-04-19 11:22:33 # Node ID 968ac00c4017a9316f7d7381133de4d8a01c48d3 # Parent 68748c2c761bf6e94c0c683fff32bd551f27a1b3 inifinitepush: fix filebundlestore to close file diff --git a/hgext/infinitepush/store.py b/hgext/infinitepush/store.py --- a/hgext/infinitepush/store.py +++ b/hgext/infinitepush/store.py @@ -86,12 +86,11 @@ class filebundlestore(object): def read(self, key): try: - f = open(self._filepath(key), 'rb') + with open(self._filepath(key), 'rb') as f: + return f.read() except IOError: return None - return f.read() - class externalbundlestore(abstractbundlestore): def __init__(self, put_binary, put_args, get_binary, get_args): """