[FIX] tools.misc: log errors when parsing fails
This commit is contained in:
parent
bdbcbea285
commit
cb609bd425
|
@ -1094,11 +1094,15 @@ def stripped_sys_argv(*strip_args):
|
|||
|
||||
class Pickle(object):
|
||||
@classmethod
|
||||
def load(cls, stream):
|
||||
def load(cls, stream, errors=False):
|
||||
unpickler = cPickle.Unpickler(stream)
|
||||
# pickle builtins: str/unicode, int/long, float, bool, tuple, list, dict, None
|
||||
unpickler.find_global = None
|
||||
return unpickler.load()
|
||||
try:
|
||||
return unpickler.load()
|
||||
except Exception:
|
||||
_logger.warning('Failed unpickling data, returning default: %r', errors, exc_info=True)
|
||||
return errors
|
||||
|
||||
@classmethod
|
||||
def loads(cls, text):
|
||||
|
|
Loading…
Reference in New Issue