]> arthur.barton.de Git - bup.git/commitdiff
Initialize MetaStoreWriter self._file to None
authorRob Browning <rlb@defaultvalue.org>
Wed, 14 May 2014 17:01:10 +0000 (12:01 -0500)
committerRob Browning <rlb@defaultvalue.org>
Wed, 14 May 2014 17:20:02 +0000 (12:20 -0500)
Without this, if something goes wrong in the constructor self._file
may not be initialized, which causes close(), invoked via __del__(),
to crash.

Thanks to Fabian Bakkum <fabianbakkum@hotmail.com> for reporting the
problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/index.py

index 4aec5c765e23e8ef85f6c0a1569abd15d8167aa9..b99e6d36a606d761731814240a7318eabeb47cfc 100644 (file)
@@ -53,6 +53,7 @@ class MetaStoreWriter:
         # Map metadata hashes to bupindex.meta offsets.
         self._offsets = {}
         self._filename = filename
+        self._file = None
         # FIXME: see how slow this is; does it matter?
         m_file = open(filename, 'ab+')
         try: