From 1b83c9cc1d75a28320dd72e3f1875c481d971f7e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 19 Feb 2009 12:36:51 +0000 Subject: [PATCH] Handle ValueError when unpickling, since this can be triggered by an unsupported pickle protocol. svn path=/main/trunk/; revision=12648 --- pym/_emerge/__init__.py | 2 +- pym/portage/__init__.py | 2 +- pym/portage/dbapi/vartree.py | 2 +- pym/portage/getbinpkg.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 073bc03ac..e8d634929 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4048,7 +4048,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping): self._cache_data = mypickle.load() f.close() del f - except (IOError, OSError, EOFError, pickle.UnpicklingError), e: + except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError), e: if isinstance(e, pickle.UnpicklingError): writemsg("!!! Error loading '%s': %s\n" % \ (self._cache_filename, str(e)), noiselevel=-1) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index b025142f9..968566129 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -7609,7 +7609,7 @@ class MtimeDB(dict): d = mypickle.load() f.close() del f - except (IOError, OSError, EOFError, pickle.UnpicklingError), e: + except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError), e: if isinstance(e, pickle.UnpicklingError): writemsg("!!! Error loading '%s': %s\n" % \ (filename, str(e)), noiselevel=-1) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index f2d0d1a77..0685382a5 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1050,7 +1050,7 @@ class vardbapi(dbapi): aux_cache = mypickle.load() f.close() del f - except (IOError, OSError, EOFError, pickle.UnpicklingError), e: + except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError), e: if isinstance(e, pickle.UnpicklingError): writemsg("!!! Error loading '%s': %s\n" % \ (self._aux_cache_filename, str(e)), noiselevel=-1) diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 89252d4b8..f657c67a1 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -491,7 +491,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= out.write("Loaded metadata pickle.\n") out.flush() metadatafile.close() - except (pickle.UnpicklingError, OSError, IOError, EOFError): + except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError): metadata = {} if baseurl not in metadata: metadata[baseurl]={} -- 2.26.2