Use protocol=2 for pickle.dump() calls, so that pickles written by py3k will
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 07:47:29 +0000 (07:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 07:47:29 +0000 (07:47 -0000)
be backward compatible. (trunk r12821)

svn path=/main/branches/2.1.6/; revision=13053

pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py
pym/portage/getbinpkg.py

index c3921aa6c133f2c1d7d54057d04ca6e0c73579b1..efbd2afd5818c7bc1853ac0a744aafbca12d3ff6 100644 (file)
@@ -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)
index b6e8068cf8483c09bccb4593c47eddb51ad6d6a6..dc007cb2472c07eb9d3be9f8783d85a09a873eb5 100644 (file)
@@ -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)
index 00a5c682fe5250d8a44362dd187fb1fe391d9799..43091d4ea42a11018279490f3d8b97fbd5f9929f 100644 (file)
@@ -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)
index 02e5de27761c5577b6dffe0baed2d37ccd260018..29e2ff4f871b6ef64106800a42175231a66ecb93 100644 (file)
@@ -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