[Python-checkins] r58083 - python/branches/alex-py3k/Lib/pickle.py

alexandre.vassalotti python-checkins at python.org
Mon Sep 10 05:52:31 CEST 2007


Author: alexandre.vassalotti
Date: Mon Sep 10 05:52:30 2007
New Revision: 58083

Modified:
   python/branches/alex-py3k/Lib/pickle.py
Log:
Use the accelerator module if available, in pickle.py.


Modified: python/branches/alex-py3k/Lib/pickle.py
==============================================================================
--- python/branches/alex-py3k/Lib/pickle.py	(original)
+++ python/branches/alex-py3k/Lib/pickle.py	Mon Sep 10 05:52:30 2007
@@ -1299,12 +1299,19 @@
         n -= 1 << (nbytes * 8)
     return n
 
+# Use the accelerator module if available.
+# XXX: Don't overload bindly, for testing the reference Python implementation
+try:
+    from _pickle import *
+except ImportError:
+    pass
+
 # Shorthands
 
-def dump(obj, file, protocol=None):
+def dump(obj, file, protocol=2):
     Pickler(file, protocol).dump(obj)
 
-def dumps(obj, protocol=None):
+def dumps(obj, protocol=2):
     f = io.BytesIO()
     Pickler(f, protocol).dump(obj)
     res = f.getvalue()


More information about the Python-checkins mailing list