← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:six-cpickle into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:six-cpickle into launchpad:master.

Commit message:
Import cPickle from six.moves

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/379469

This part of the standard library was rearranged in Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:six-cpickle into launchpad:master.
diff --git a/lib/lp/bugs/scripts/bugimport.py b/lib/lp/bugs/scripts/bugimport.py
index ed3d8c5..1d872de 100644
--- a/lib/lp/bugs/scripts/bugimport.py
+++ b/lib/lp/bugs/scripts/bugimport.py
@@ -14,7 +14,6 @@ __all__ = [
     'BugImporter',
     ]
 
-import cPickle
 from cStringIO import StringIO
 import datetime
 import logging
@@ -23,6 +22,7 @@ import time
 
 from defusedxml import cElementTree
 import pytz
+from six.moves import cPickle as pickle
 from storm.store import Store
 from zope.component import getUtility
 from zope.contenttype import guess_content_type
@@ -215,15 +215,15 @@ class BugImporter:
             self.bug_id_map = {}
             self.pending_duplicates = {}
         else:
-            self.bug_id_map, self.pending_duplicates = cPickle.load(
+            self.bug_id_map, self.pending_duplicates = pickle.load(
                 open(self.cache_filename, 'rb'))
 
     def saveCache(self):
         """Save the bug ID mapping and pending duplicates list to cache."""
         tmpfilename = '%s.tmp' % self.cache_filename
         fp = open(tmpfilename, 'wb')
-        cPickle.dump((self.bug_id_map, self.pending_duplicates),
-                     fp, protocol=2)
+        pickle.dump((self.bug_id_map, self.pending_duplicates),
+                    fp, protocol=2)
         fp.close()
         os.rename(tmpfilename, self.cache_filename)
 
diff --git a/lib/lp/services/testing/profiled.py b/lib/lp/services/testing/profiled.py
index f0560e4..620d2fa 100644
--- a/lib/lp/services/testing/profiled.py
+++ b/lib/lp/services/testing/profiled.py
@@ -7,11 +7,12 @@ __metaclass__ = type
 __all__ = ['profiled', 'setup_profiling']
 
 import atexit
-import cPickle as pickle
 import os
 import tempfile
 import time
 
+from six.moves import cPickle as pickle
+
 
 _profile_stats_filename = os.environ.get('lp_layer_profile_filename', None)
 _profiling_setup_time = None
diff --git a/lib/lp/services/utils.py b/lib/lp/services/utils.py
index 04e24aa..beda118 100644
--- a/lib/lp/services/utils.py
+++ b/lib/lp/services/utils.py
@@ -33,7 +33,6 @@ __all__ = [
     ]
 
 import bz2
-import cPickle as pickle
 from datetime import datetime
 from itertools import (
     islice,
@@ -53,6 +52,7 @@ from fixtures import (
     )
 from lazr.enum import BaseItem
 import pytz
+from six.moves import cPickle as pickle
 from twisted.python.util import mergeFunctionMetadata
 from zope.security.proxy import isinstance as zope_isinstance
 
diff --git a/lib/lp/services/webapp/pgsession.py b/lib/lp/services/webapp/pgsession.py
index edbb0b0..a11fedb 100644
--- a/lib/lp/services/webapp/pgsession.py
+++ b/lib/lp/services/webapp/pgsession.py
@@ -5,12 +5,12 @@
 
 __metaclass__ = type
 
-import cPickle as pickle
 import hashlib
 import time
 from UserDict import DictMixin
 
 from lazr.restful.utils import get_current_browser_request
+from six.moves import cPickle as pickle
 from storm.zope.interfaces import IZStorm
 from zope.authentication.interfaces import IUnauthenticatedPrincipal
 from zope.component import getUtility