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

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

pym/portage/dbapi/vartree.py

index 69b1512ef5eca4cbd913562bd18024c6c135b0b1..428e3d24e8ccd0ecf88affa374697c5487c619b8 100644 (file)
@@ -602,8 +602,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 \