summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-17 08:57:26 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-17 08:57:26 (GMT)
commitba205d6971db8ec8523e7a8f5a86422b1bfcc9f5 (patch)
tree966d1277b2e802e14067fb72b88e6122f92f1390 /Lib/logging
parent06a2dc785986240e4598f96c510f83eea14c6658 (diff)
downloadcpython-ba205d6971db8ec8523e7a8f5a86422b1bfcc9f5.zip
cpython-ba205d6971db8ec8523e7a8f5a86422b1bfcc9f5.tar.gz
cpython-ba205d6971db8ec8523e7a8f5a86422b1bfcc9f5.tar.bz2
If cPickle isn't available, use pickle.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 3552950..a0255ce 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -27,7 +27,11 @@ Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, logging, socket, types, os, string, cPickle, struct, time, glob
+import sys, logging, socket, types, os, string, struct, time, glob
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
try:
import codecs
@@ -389,7 +393,7 @@ class SocketHandler(logging.Handler):
if ei:
dummy = self.format(record) # just to get traceback text into record.exc_text
record.exc_info = None # to avoid Unpickleable error
- s = cPickle.dumps(record.__dict__, 1)
+ s = pickle.dumps(record.__dict__, 1)
if ei:
record.exc_info = ei # for next handler
slen = struct.pack(">L", len(s))