Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38c96a3

Browse files
committed
Patch for an Issue #260
1 parent 8fe8bea commit 38c96a3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/core/convert.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ def base64encode(value):
2828
return value.encode("base64")[:-1].replace("\n", "")
2929

3030
def base64pickle(value):
31-
return base64encode(pickle.dumps(value, pickle.HIGHEST_PROTOCOL))
31+
retVal = None
32+
try:
33+
retVal = base64encode(pickle.dumps(value, pickle.HIGHEST_PROTOCOL))
34+
except:
35+
warnMsg = "problem occurred while serializing "
36+
warnMsg += "instance of a type '%s'" % type(value)
37+
singleTimeWarnMessage(warnMsg)
38+
39+
retVal = base64encode(pickle.dumps(str(value), pickle.HIGHEST_PROTOCOL))
40+
return retVal
3241

3342
def base64unpickle(value):
3443
return pickle.loads(base64decode(value))

0 commit comments

Comments
 (0)