mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
If cPickle isn't available, use pickle.
This commit is contained in:
parent
06a2dc7859
commit
ba205d6971
1 changed files with 6 additions and 2 deletions
|
@ -27,7 +27,11 @@ Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
|
||||||
To use, simply 'import logging' and log away!
|
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:
|
try:
|
||||||
import codecs
|
import codecs
|
||||||
|
@ -389,7 +393,7 @@ class SocketHandler(logging.Handler):
|
||||||
if ei:
|
if ei:
|
||||||
dummy = self.format(record) # just to get traceback text into record.exc_text
|
dummy = self.format(record) # just to get traceback text into record.exc_text
|
||||||
record.exc_info = None # to avoid Unpickleable error
|
record.exc_info = None # to avoid Unpickleable error
|
||||||
s = cPickle.dumps(record.__dict__, 1)
|
s = pickle.dumps(record.__dict__, 1)
|
||||||
if ei:
|
if ei:
|
||||||
record.exc_info = ei # for next handler
|
record.exc_info = ei # for next handler
|
||||||
slen = struct.pack(">L", len(s))
|
slen = struct.pack(">L", len(s))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue