diff options
author | Guido van Rossum <guido@python.org> | 2007-07-20 00:22:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-20 00:22:32 (GMT) |
commit | 99603b0c1edb4b8ca2a30fa90470170b959321ee (patch) | |
tree | f0fef33a9c03529354c01f5fd374fd36ebc024d7 /Lib | |
parent | be6fe5476cc3233ac20e02c0063355a5884663f7 (diff) | |
download | cpython-99603b0c1edb4b8ca2a30fa90470170b959321ee.zip cpython-99603b0c1edb4b8ca2a30fa90470170b959321ee.tar.gz cpython-99603b0c1edb4b8ca2a30fa90470170b959321ee.tar.bz2 |
Getting rid of cPickle. Mmm, feels good!
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/Cookie.py | 22 | ||||
-rw-r--r-- | Lib/bsddb/dbtables.py | 2 | ||||
-rw-r--r-- | Lib/bsddb/test/test_dbtables.py | 6 | ||||
-rw-r--r-- | Lib/bsddb/test/test_pickle.py | 8 | ||||
-rw-r--r-- | Lib/collections.py | 2 | ||||
-rw-r--r-- | Lib/copy_reg.py | 4 | ||||
-rw-r--r-- | Lib/idlelib/rpc.py | 2 | ||||
-rw-r--r-- | Lib/logging/handlers.py | 5 | ||||
-rw-r--r-- | Lib/pickle.py | 13 | ||||
-rw-r--r-- | Lib/pickletools.py | 10 | ||||
-rw-r--r-- | Lib/test/pickletester.py | 6 | ||||
-rw-r--r-- | Lib/test/test_bool.py | 41 | ||||
-rw-r--r-- | Lib/test/test_bytes.py | 12 | ||||
-rw-r--r-- | Lib/test/test_cpickle.py | 103 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 31 | ||||
-rw-r--r-- | Lib/test/test_exceptions.py | 8 | ||||
-rw-r--r-- | Lib/test/test_re.py | 6 | ||||
-rw-r--r-- | Lib/test/test_slice.py | 2 | ||||
-rw-r--r-- | Lib/test/test_xpickle.py | 44 | ||||
-rw-r--r-- | Lib/trace.py | 6 |
20 files changed, 37 insertions, 296 deletions
diff --git a/Lib/Cookie.py b/Lib/Cookie.py index 52a766d..ca559e8 100644 --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -149,11 +149,10 @@ the value to a string, when the values are set dictionary-style. SerialCookie The SerialCookie expects that all values should be serialized using -cPickle (or pickle, if cPickle isn't available). As a result of -serializing, SerialCookie can save almost any Python object to a -value, and recover the exact same object when the cookie has been -returned. (SerialCookie can yield some strange-looking cookie -values, however.) +pickle. As a result of serializing, SerialCookie can save almost any +Python object to a value, and recover the exact same object when the +cookie has been returned. (SerialCookie can yield some +strange-looking cookie values, however.) >>> C = Cookie.SerialCookie() >>> C["number"] = 7 @@ -162,7 +161,7 @@ values, however.) 7 >>> C["string"].value 'seven' - >>> C.output().replace('p0', 'p1') # Hack for cPickle/pickle differences + >>> C.output().replace('p0', 'p1') # Hack for pickling differences 'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string="Vseven\\012p1\\012."' Be warned, however, if SerialCookie cannot de-serialize a value (because @@ -173,7 +172,7 @@ SmartCookie The SmartCookie combines aspects of each of the other two flavors. When setting a value in a dictionary-fashion, the SmartCookie will -serialize (ala cPickle) the value *if and only if* it isn't a +serialize (ala pickle) the value *if and only if* it isn't a Python string. String objects are *not* serialized. Similarly, when the load() method parses out values, it attempts to de-serialize the value. If it fails, then it fallsback to treating the value @@ -212,10 +211,7 @@ Finis. # import string -try: - from cPickle import dumps, loads -except ImportError: - from pickle import dumps, loads +from pickle import dumps, loads import re, warnings @@ -660,7 +656,7 @@ class SimpleCookie(BaseCookie): class SerialCookie(BaseCookie): """SerialCookie SerialCookie supports arbitrary objects as cookie values. All - values are serialized (using cPickle) before being sent to the + values are serialized (using pickle) before being sent to the client. All incoming values are assumed to be valid Pickle representations. IF AN INCOMING VALUE IS NOT IN A VALID PICKLE FORMAT, THEN AN EXCEPTION WILL BE RAISED. @@ -687,7 +683,7 @@ class SmartCookie(BaseCookie): """SmartCookie SmartCookie supports arbitrary objects as cookie values. If the object is a string, then it is quoted. If the object is not a - string, however, then SmartCookie will use cPickle to serialize + string, however, then SmartCookie will use pickle to serialize the object into a string representation. Note: Large cookie values add overhead because they must be diff --git a/Lib/bsddb/dbtables.py b/Lib/bsddb/dbtables.py index 97ea6a7..690e280 100644 --- a/Lib/bsddb/dbtables.py +++ b/Lib/bsddb/dbtables.py @@ -22,7 +22,7 @@ import sys import copy import xdrlib import random -import cPickle as pickle +import pickle try: # For Pythons w/distutils pybsddb diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py index a7c2c27..0701cca 100644 --- a/Lib/bsddb/test/test_dbtables.py +++ b/Lib/bsddb/test/test_dbtables.py @@ -21,11 +21,7 @@ # $Id$ import sys, os, re -try: - import cPickle - pickle = cPickle -except ImportError: - import pickle +import pickle import tempfile import unittest diff --git a/Lib/bsddb/test/test_pickle.py b/Lib/bsddb/test/test_pickle.py index 95cb23d..a5ccfa3 100644 --- a/Lib/bsddb/test/test_pickle.py +++ b/Lib/bsddb/test/test_pickle.py @@ -1,10 +1,6 @@ import sys, os import pickle -try: - import cPickle -except ImportError: - cPickle = None import unittest import glob @@ -62,10 +58,6 @@ class pickleTestCase(unittest.TestCase): def test01_pickle_DBError(self): self._base_test_pickle_DBError(pickle=pickle) - if cPickle: - def test02_cPickle_DBError(self): - self._base_test_pickle_DBError(pickle=cPickle) - #---------------------------------------------------------------------- def test_suite(): diff --git a/Lib/collections.py b/Lib/collections.py index b2d40d6..8e9f6d6 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -58,7 +58,7 @@ def NamedTuple(typename, s): if __name__ == '__main__': # verify that instances are pickable - from cPickle import loads, dumps + from pickle import loads, dumps Point = NamedTuple('Point', 'x y') p = Point(x=10, y=20) assert p == loads(dumps(p)) diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 4f77c6f..59b6b97 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -1,4 +1,4 @@ -"""Helper to provide extensibility for pickle/cPickle. +"""Helper to provide extensibility for pickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. @@ -146,7 +146,7 @@ def _slotnames(cls): _extension_registry = {} # key -> code _inverted_registry = {} # code -> key _extension_cache = {} # code -> object -# Don't ever rebind those names: cPickle grabs a reference to them when +# Don't ever rebind those names: pickling grabs a reference to them when # it's initialized, and won't see a rebinding. def add_extension(module, name, code): diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index 6471e81..2f3b56d 100644 --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -33,7 +33,7 @@ import socket import select import SocketServer import struct -import cPickle as pickle +import pickle import threading import Queue import traceback diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 75434b7..2279db2 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -28,10 +28,7 @@ To use, simply 'import logging' and log away! """ import sys, logging, socket, os, struct, time, glob -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle from stat import ST_DEV, ST_INO try: diff --git a/Lib/pickle.py b/Lib/pickle.py index 9570dd4..6901a64 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -1,6 +1,5 @@ """Create portable serialized representations of Python objects. -See module cPickle for a (much) faster implementation. See module copy_reg for a mechanism for registering custom picklers. See module pickletools source for extensive comments. @@ -48,8 +47,7 @@ compatible_formats = ["1.0", # Original protocol 0 "2.0", # Protocol 2 ] # Old format versions we can read -# Keep in synch with cPickle. This is the highest protocol number we -# know how to read. +# This is the highest protocol number we know how to read. HIGHEST_PROTOCOL = 2 # The protocol we write by default. May be less than HIGHEST_PROTOCOL. @@ -591,8 +589,6 @@ class Pickler: dispatch[list] = save_list - # Keep in synch with cPickle's BATCHSIZE. Nothing will break if it gets - # out of synch, though. _BATCHSIZE = 1000 def _batch_appends(self, items): @@ -1090,7 +1086,12 @@ class Unpickler: stack = self.stack args = stack.pop() func = stack[-1] - value = func(*args) + try: + value = func(*args) + except: + print(sys.exc_info()) + print(func, args) + raise stack[-1] = value dispatch[REDUCE[0]] = load_reduce diff --git a/Lib/pickletools.py b/Lib/pickletools.py index 226facc..8c324c7 100644 --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -597,7 +597,7 @@ float8 = ArgumentDescriptor( doc="""An 8-byte binary representation of a float, big-endian. The format is unique to Python, and shared with the struct - module (format string '>d') "in theory" (the struct and cPickle + module (format string '>d') "in theory" (the struct and pickle implementations don't share the code -- they should). It's strongly related to the IEEE-754 double format, and, in normal cases, is in fact identical to the big-endian 754 double format. @@ -1587,9 +1587,8 @@ opcodes = [ first insists that the class object have a __safe_for_unpickling__ attribute. Unlike as for the __safe_for_unpickling__ check in REDUCE, it doesn't matter whether this attribute has a true or false value, it - only matters whether it exists (XXX this is a bug; cPickle - requires the attribute to be true). If __safe_for_unpickling__ - doesn't exist, UnpicklingError is raised. + only matters whether it exists (XXX this is a bug). If + __safe_for_unpickling__ doesn't exist, UnpicklingError is raised. Else (the class object does have a __safe_for_unpickling__ attr), the class object obtained from INST's arguments is applied to the @@ -1624,8 +1623,7 @@ opcodes = [ As for INST, the remainder of the stack above the markobject is gathered into an argument tuple, and then the logic seems identical, except that no __safe_for_unpickling__ check is done (XXX this is - a bug; cPickle does test __safe_for_unpickling__). See INST for - the gory details. + a bug). See INST for the gory details. NOTE: In Python 2.3, INST and OBJ are identical except for how they get the class object. That was always the intent; the implementations diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 927939e..7bff76f 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -1,9 +1,5 @@ import unittest import pickle -try: - import cPickle -except ImportError: - cPickle = None import pickletools import copy_reg @@ -12,8 +8,6 @@ from test.test_support import TestFailed, TESTFN, run_with_locale # Tests that try a number of pickle protocols should have a # for proto in protocols: # kind of outer loop. -if cPickle is not None: - assert pickle.HIGHEST_PROTOCOL == cPickle.HIGHEST_PROTOCOL == 2 protocols = range(pickle.HIGHEST_PROTOCOL + 1) diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py index 8006370..7a9022e 100644 --- a/Lib/test/test_bool.py +++ b/Lib/test/test_bool.py @@ -268,34 +268,6 @@ class BoolTest(unittest.TestCase): self.assertIs(pickle.loads(pickle.dumps(True, True)), True) self.assertIs(pickle.loads(pickle.dumps(False, True)), False) - def test_cpickle(self): - try: - import cPickle - except ImportError: - return # Just ignore this if cPickle doesn't exist - - self.assertIs(cPickle.loads(cPickle.dumps(True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False)), False) - self.assertIs(cPickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(cPickle.dumps(False, True)), False) - - def test_mixedpickle(self): - import pickle - try: - import cPickle - except ImportError: - return # Just ignore this if cPickle doesn't exist - - self.assertIs(pickle.loads(cPickle.dumps(True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False)), False) - self.assertIs(pickle.loads(cPickle.dumps(True, True)), True) - self.assertIs(pickle.loads(cPickle.dumps(False, True)), False) - - self.assertIs(cPickle.loads(pickle.dumps(True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False)), False) - self.assertIs(cPickle.loads(pickle.dumps(True, True)), True) - self.assertIs(cPickle.loads(pickle.dumps(False, True)), False) - def test_picklevalues(self): # Test for specific backwards-compatible pickle values import pickle @@ -306,19 +278,6 @@ class BoolTest(unittest.TestCase): self.assertEqual(pickle.dumps(True, protocol=2), b'\x80\x02\x88.') self.assertEqual(pickle.dumps(False, protocol=2), b'\x80\x02\x89.') - def test_cpicklevalues(self): - # Test for specific backwards-compatible pickle values - try: - import cPickle - except ImportError: - return # Just ignore the rest if cPickle doesn't exist - self.assertEqual(cPickle.dumps(True, protocol=0), b"I01\n.") - self.assertEqual(cPickle.dumps(False, protocol=0), b"I00\n.") - self.assertEqual(cPickle.dumps(True, protocol=1), b"I01\n.") - self.assertEqual(cPickle.dumps(False, protocol=1), b"I00\n.") - self.assertEqual(cPickle.dumps(True, protocol=2), b'\x80\x02\x88.') - self.assertEqual(cPickle.dumps(False, protocol=2), b'\x80\x02\x89.') - def test_convert_to_bool(self): # Verify that TypeError occurs when bad things are returned # from __bool__(). This isn't really a bool test, but diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index ca22ef1..094c56c 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -4,7 +4,6 @@ import os import re import sys import pickle -import cPickle import tempfile import unittest import test.test_support @@ -641,12 +640,11 @@ class BytesTest(unittest.TestCase): self.assertEqual(b.rpartition(b'i'), (b'mississipp', b'i', b'')) def test_pickling(self): - for pm in pickle, cPickle: - for proto in range(pm.HIGHEST_PROTOCOL): - for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0": - ps = pm.dumps(b, proto) - q = pm.loads(ps) - self.assertEqual(b, q) + for proto in range(pickle.HIGHEST_PROTOCOL): + for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0": + ps = pickle.dumps(b, proto) + q = pickle.loads(ps) + self.assertEqual(b, q) def test_strip(self): b = b'mississippi' diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py deleted file mode 100644 index 78beda7..0000000 --- a/Lib/test/test_cpickle.py +++ /dev/null @@ -1,103 +0,0 @@ -import cPickle -import unittest -from cStringIO import StringIO -from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests -from test import test_support - -class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): - - def setUp(self): - self.dumps = cPickle.dumps - self.loads = cPickle.loads - - error = cPickle.BadPickleGet - module = cPickle - -class cPicklePicklerTests(AbstractPickleTests): - - def dumps(self, arg, proto=0): - f = StringIO() - p = cPickle.Pickler(f, proto) - p.dump(arg) - f.seek(0) - return f.read() - - def loads(self, buf): - f = StringIO(buf) - p = cPickle.Unpickler(f) - return p.load() - - error = cPickle.BadPickleGet - -class cPickleListPicklerTests(AbstractPickleTests): - - def dumps(self, arg, proto=0): - p = cPickle.Pickler(proto) - p.dump(arg) - return p.getvalue() - - def loads(self, *args): - f = StringIO(args[0]) - p = cPickle.Unpickler(f) - return p.load() - - error = cPickle.BadPickleGet - -class cPickleFastPicklerTests(AbstractPickleTests): - - def dumps(self, arg, proto=0): - f = StringIO() - p = cPickle.Pickler(f, proto) - p.fast = 1 - p.dump(arg) - f.seek(0) - return f.read() - - def loads(self, *args): - f = StringIO(args[0]) - p = cPickle.Unpickler(f) - return p.load() - - error = cPickle.BadPickleGet - - def test_recursive_list(self): - self.assertRaises(ValueError, - AbstractPickleTests.test_recursive_list, - self) - - def test_recursive_inst(self): - self.assertRaises(ValueError, - AbstractPickleTests.test_recursive_inst, - self) - - def test_recursive_dict(self): - self.assertRaises(ValueError, - AbstractPickleTests.test_recursive_dict, - self) - - def test_recursive_multi(self): - self.assertRaises(ValueError, - AbstractPickleTests.test_recursive_multi, - self) - - def test_nonrecursive_deep(self): - # If it's not cyclic, it should pickle OK even if the nesting - # depth exceeds PY_CPICKLE_FAST_LIMIT. That happens to be - # 50 today. Jack Jansen reported stack overflow on Mac OS 9 - # at 64. - a = [] - for i in range(60): - a = [a] - b = self.loads(self.dumps(a)) - self.assertEqual(a, b) - -def test_main(): - test_support.run_unittest( - cPickleTests, - cPicklePicklerTests, - cPickleListPicklerTests, - cPickleFastPicklerTests - ) - -if __name__ == "__main__": - test_main() diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 110e3a8..8e57b90 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2807,10 +2807,6 @@ def pickles(): if verbose: print("Testing pickling and copying new-style classes and objects...") import pickle - try: - import cPickle - except ImportError: - cPickle = None def sorteditems(d): return sorted(d.items()) @@ -2863,9 +2859,7 @@ def pickles(): class C4(C4classic, object): # mixed inheritance pass - for p in pickle, cPickle: - if p is None: - continue # cPickle not found -- skip it + for p in [pickle]: for bin in 0, 1: if verbose: print(p.__name__, ["text", "binary"][bin]) @@ -2925,7 +2919,7 @@ def pickles(): def pickleslots(): if verbose: print("Testing pickling of classes with __slots__ ...") - import pickle, pickle as cPickle + import pickle # Pickling of classes with __slots__ but without __getstate__ should fail # (when using protocols 0 or 1) global B, C, D, E @@ -2943,23 +2937,11 @@ def pickleslots(): else: raise TestFailed, "should fail: pickle C instance - %s" % base try: - cPickle.dumps(C(), 0) - except TypeError: - pass - else: - raise TestFailed, "should fail: cPickle C instance - %s" % base - try: pickle.dumps(C(), 0) except TypeError: pass else: raise TestFailed, "should fail: pickle D instance - %s" % base - try: - cPickle.dumps(D(), 0) - except TypeError: - pass - else: - raise TestFailed, "should fail: cPickle D instance - %s" % base # Give C a nice generic __getstate__ and __setstate__ class C(base): __slots__ = ['a'] @@ -2984,20 +2966,14 @@ def pickleslots(): x = C() y = pickle.loads(pickle.dumps(x)) vereq(hasattr(y, 'a'), 0) - y = cPickle.loads(cPickle.dumps(x)) - vereq(hasattr(y, 'a'), 0) x.a = 42 y = pickle.loads(pickle.dumps(x)) vereq(y.a, 42) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a, 42) x = D() x.a = 42 x.b = 100 y = pickle.loads(pickle.dumps(x)) vereq(y.a + y.b, 142) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a + y.b, 142) # A subclass that adds a slot should also work class E(C): __slots__ = ['b'] @@ -3007,9 +2983,6 @@ def pickleslots(): y = pickle.loads(pickle.dumps(x)) vereq(y.a, x.a) vereq(y.b, x.b) - y = cPickle.loads(cPickle.dumps(x)) - vereq(y.a, x.a) - vereq(y.b, x.b) def copies(): if verbose: print("Testing copy.copy() and copy.deepcopy()...") diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 56a990d..0988098 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -4,10 +4,6 @@ import os import sys import unittest import pickle -try: - import cPickle -except ImportError: - cPickle = None from test.test_support import (TESTFN, unlink, run_unittest, guard_warnings_filter) @@ -299,9 +295,7 @@ class ExceptionTests(unittest.TestCase): value, expected[checkArgName])) # test for pickling support - for p in pickle, cPickle: - if p is None: - continue # cPickle not found -- skip it + for p in [pickle]: for protocol in range(p.HIGHEST_PROTOCOL + 1): s = p.dumps(e, protocol) new = p.loads(s) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index f69dde5..f14ff49 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -412,12 +412,6 @@ class ReTests(unittest.TestCase): def test_pickling(self): import pickle self.pickle_test(pickle) - try: - import cPickle - except ImportError: - pass # cPickle not found -- skip it - else: - self.pickle_test(cPickle) # old pickles expect the _compile() reconstructor in sre module import warnings with guard_warnings_filter(): diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 77a2931..4d89aa6 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -2,7 +2,7 @@ import unittest from test import test_support -from cPickle import loads, dumps +from pickle import loads, dumps import sys diff --git a/Lib/test/test_xpickle.py b/Lib/test/test_xpickle.py deleted file mode 100644 index 42cd0f4..0000000 --- a/Lib/test/test_xpickle.py +++ /dev/null @@ -1,44 +0,0 @@ -# test_pickle dumps and loads pickles via pickle.py. -# test_cpickle does the same, but via the cPickle module. -# This test covers the other two cases, making pickles with one module and -# loading them via the other. - -import pickle -import cPickle -import unittest - -from test import test_support -from test.pickletester import AbstractPickleTests - -class DumpCPickle_LoadPickle(AbstractPickleTests): - - error = KeyError - - def dumps(self, arg, proto=0, fast=0): - # Ignore fast - return cPickle.dumps(arg, proto) - - def loads(self, buf): - # Ignore fast - return pickle.loads(buf) - -class DumpPickle_LoadCPickle(AbstractPickleTests): - - error = cPickle.BadPickleGet - - def dumps(self, arg, proto=0, fast=0): - # Ignore fast - return pickle.dumps(arg, proto) - - def loads(self, buf): - # Ignore fast - return cPickle.loads(buf) - -def test_main(): - test_support.run_unittest( - DumpCPickle_LoadPickle, - DumpPickle_LoadCPickle - ) - -if __name__ == "__main__": - test_main() diff --git a/Lib/trace.py b/Lib/trace.py index 79d2171..d40f13c 100644 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -58,11 +58,7 @@ import tokenize import types import gc -try: - import cPickle - pickle = cPickle -except ImportError: - import pickle +import pickle def usage(outfile): outfile.write("""Usage: %s [OPTIONS] <file> [ARGS] |