Skip to content

Commit 413af5f

Browse files
base64 encode deferred payloads for better compatibility
1 parent 9432aae commit 413af5f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/google/appengine/ext/deferred/deferred.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def hello_world():
107107

108108

109109

110-
110+
import base64
111111
import http
112112
import logging
113113
import os
@@ -159,7 +159,7 @@ def run(data):
159159
PermanentTaskFailure if an error occurred during unpickling the task.
160160
"""
161161
try:
162-
func, args, kwds = pickle.loads(data)
162+
func, args, kwds = pickle.loads(base64.b64decode(data))
163163
except Exception as e:
164164
raise PermanentTaskFailure(e)
165165
else:
@@ -265,10 +265,10 @@ def serialize(obj, *args, **kwargs):
265265
"""
266266
curried = _curry_callable(obj, *args, **kwargs)
267267
if os.environ.get("DEFERRED_USE_CROSS_COMPATIBLE_PICKLE_PROTOCOL", False):
268-
protocol = 0
268+
protocol = 2
269269
else:
270270
protocol = pickle.HIGHEST_PROTOCOL
271-
return pickle.dumps(curried, protocol)
271+
return base64.b64encode(pickle.dumps(curried, protocol))
272272

273273

274274
def defer(obj, *args, **kwargs):

0 commit comments

Comments
 (0)