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

svn path=/main/branches/2.1.2/; revision=10435

bin/emerge
pym/portage.py

index acb42e4f2f7182b3011e389fac3f97d7dff0b34f..424fbdc9151784cc06e9bd5690d6ac0666e87907 100755 (executable)
@@ -1557,8 +1557,11 @@ 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 414fffd7c174af8d9c5abf684df83bbacbe3c4bf..b126fac3e40df482a4f9e23f9134a022064ead13 100644 (file)
@@ -6923,8 +6923,11 @@ class vardbapi(dbapi):
                                self._aux_cache = 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._aux_cache_filename, str(e)), noiselevel=-1)
+                               del e
                        if not self._aux_cache or \
                                not isinstance(self._aux_cache, dict) or \
                                self._aux_cache.get("version") != self._aux_cache_version or \
@@ -10489,7 +10492,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: