Don't silently swallow instances of UnpicklingError since they are easily
authorZac Medico <zmedico@gentoo.org>
Mon, 26 May 2008 23:16:13 +0000 (23:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 26 May 2008 23:16:13 +0000 (23:16 -0000)
triggered by storing instances of custom classes in a pickle.

svn path=/main/trunk/; revision=10433

pym/_emerge/__init__.py
pym/portage/__init__.py

index bf5c4aeeac3ec3e8ac35ac918247cc0a35ef9171..b045b02f1c34aad4d59afe08cb0b3cf807e33837 100644 (file)
@@ -1423,8 +1423,12 @@ class BlockerCache(DictMixin):
                        self._cache_data = mypickle.load()
                        f.close()
                        del f
-               except (IOError, OSError, EOFError, cPickle.UnpicklingError):
-                       pass
+               except (IOError, OSError, EOFError, cPickle.UnpicklingError), e:
+                       if isinstance(e, cPickle.UnpicklingError):
+                               writemsg("!!! Error loading '%s': %s\n" % \
+                                       (self._cache_filename, str(e)), noiselevel=-1)
+                       del e
+
                cache_valid = self._cache_data and \
                        isinstance(self._cache_data, dict) and \
                        self._cache_data.get("version") == self._cache_version and \
index f8dbc2d22e27354a2497dbe5268e8be65d74898b..d9021a466425cba84fce52d0d0cd685ff9e926aa 100644 (file)
@@ -6550,7 +6550,11 @@ class MtimeDB(dict):
                        d = mypickle.load()
                        f.close()
                        del f
-               except (IOError, OSError, EOFError, cPickle.UnpicklingError):
+               except (IOError, OSError, EOFError, cPickle.UnpicklingError), e:
+                       if isinstance(e, cPickle.UnpicklingError):
+                               writemsg("!!! Error loading '%s': %s\n" % \
+                                       (filename, str(e)), noiselevel=-1)
+                       del e
                        d = {}
 
                if "old" in d: