From 50fb774041fd614330fd3feb0faa2de3a1197fc9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 11 Mar 2009 07:47:29 +0000 Subject: [PATCH] Use protocol=2 for pickle.dump() calls, so that pickles written by py3k will be backward compatible. (trunk r12821) svn path=/main/branches/2.1.6/; revision=13053 --- pym/_emerge/__init__.py | 2 +- pym/portage/__init__.py | 2 +- pym/portage/dbapi/vartree.py | 2 +- pym/portage/getbinpkg.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index c3921aa6c..efbd2afd5 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -4178,7 +4178,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping): secpass >= 2: try: f = portage.util.atomic_ofstream(self._cache_filename, mode='wb') - pickle.dump(self._cache_data, f, -1) + pickle.dump(self._cache_data, f, protocol=2) f.close() portage.util.apply_secpass_permissions( self._cache_filename, gid=portage.portage_gid, mode=0644) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index b6e8068cf..dc007cb24 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -7528,7 +7528,7 @@ def commit_mtimedb(mydict=None, filename=None): d.update(mydict) try: f = atomic_ofstream(filename, mode='wb') - pickle.dump(d, f, -1) + pickle.dump(d, f, protocol=2) f.close() portage.util.apply_secpass_permissions(filename, uid=uid, gid=portage_gid, mode=0644) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 00a5c682f..43091d4ea 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -378,7 +378,7 @@ class vardbapi(dbapi): del self._aux_cache["modified"] try: f = atomic_ofstream(self._aux_cache_filename, 'wb') - pickle.dump(self._aux_cache, f, -1) + pickle.dump(self._aux_cache, f, protocol=2) f.close() apply_secpass_permissions( self._aux_cache_filename, gid=portage_gid, mode=0644) diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 02e5de277..29e2ff4f8 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -581,7 +581,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= sys.stderr.flush() try: metadatafile = open(metadatafilename, 'wb') - pickle.dump(metadata,metadatafile) + pickle.dump(metadata, metadatafile, protocol=2) metadatafile.close() except SystemExit, e: raise @@ -673,11 +673,11 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= if "modified" in metadata[baseurl] and metadata[baseurl]["modified"]: metadata[baseurl]["timestamp"] = int(time.time()) metadatafile = open(metadatafilename, 'wb') - pickle.dump(metadata,metadatafile) + pickle.dump(metadata, metadatafile, protocol=2) metadatafile.close() if makepickle: metadatafile = open(makepickle, 'wb') - pickle.dump(metadata[baseurl]["data"],metadatafile) + pickle.dump(metadata[baseurl]["data"], metadatafile, protocol=2) metadatafile.close() except SystemExit, e: raise -- 2.26.2