Skip to content

Commit

Permalink
base64 encode deferred payloads for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-lopreiato committed Jan 1, 2022
1 parent 530a54b commit 0330577
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/google/appengine/ext/deferred/deferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def hello_world():




import base64
import http
import logging
import os
Expand Down Expand Up @@ -159,7 +159,7 @@ def run(data):
PermanentTaskFailure if an error occurred during unpickling the task.
"""
try:
func, args, kwds = pickle.loads(data)
func, args, kwds = pickle.loads(base64.b64decode(data))
except Exception as e:
raise PermanentTaskFailure(e)
else:
Expand Down Expand Up @@ -266,10 +266,10 @@ def serialize(obj, *args, **kwargs):
"""
curried = _curry_callable(obj, *args, **kwargs)
if os.environ.get("DEFERRED_USE_CROSS_COMPATIBLE_PICKLE_PROTOCOL", False):
protocol = 0
protocol = 2
else:
protocol = pickle.HIGHEST_PROTOCOL
return pickle.dumps(curried, protocol)
return base64.b64encode(pickle.dumps(curried, protocol))


def defer(obj, *args, **kwargs):
Expand Down

0 comments on commit 0330577

Please sign in to comment.