[FIX] tools.misc: log errors when parsing fails

This commit is contained in:
Olivier Dony 2016-02-03 02:25:09 +01:00
parent bdbcbea285
commit cb609bd425
1 changed files with 6 additions and 2 deletions

View File

@ -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):