From 2f43386bd8d07d855388b9e8b759b76f7ccc9933 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 26 May 2008 23:16:13 +0000 Subject: [PATCH] Don't silently swallow instances of UnpicklingError since they are easily triggered by storing instances of custom classes in a pickle. svn path=/main/trunk/; revision=10433 --- pym/_emerge/__init__.py | 8 ++++++-- pym/portage/__init__.py | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index bf5c4aeea..b045b02f1 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -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 \ diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index f8dbc2d22..d9021a466 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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: -- 2.26.2