From: Zac Medico Date: Sat, 29 Sep 2012 02:36:17 +0000 (-0700) Subject: Handle KeyError when loading pickles. X-Git-Tag: v2.2.0_alpha135~15 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2377357f4e0164d338c1249c79f479229aa7c0e4;p=portage.git Handle KeyError when loading pickles. See http://forums.gentoo.org/viewtopic-t-938022.html for example. --- diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py index fce81f83a..91955249b 100644 --- a/pym/_emerge/BlockerCache.py +++ b/pym/_emerge/BlockerCache.py @@ -62,7 +62,9 @@ class BlockerCache(portage.cache.mappings.MutableMapping): self._cache_data = mypickle.load() f.close() del f - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: + except (SystemExit, KeyboardInterrupt): + raise + except Exception as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): pass diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index f8980f7a0..5299b298f 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -585,7 +585,9 @@ class vardbapi(dbapi): aux_cache = mypickle.load() f.close() del f - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: + except (SystemExit, KeyboardInterrupt): + raise + except Exception as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): pass diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 34a5e0efe..538f8c23c 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -559,7 +559,9 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= out.write(_("Loaded metadata pickle.\n")) out.flush() metadatafile.close() - except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError): + except (SystemExit, KeyboardInterrupt): + raise + except Exception: metadata = {} if baseurl not in metadata: metadata[baseurl]={}