Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat empty/missing writeable as a no-op #4659

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions distributed/protocol/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ def pickle_dumps(x, context=None):
def pickle_loads(header, frames):
x, buffers = frames[0], frames[1:]

writeable = header.get("writeable")
if not writeable:
writeable = len(buffers) * (None,)

new = []
memoryviews = map(memoryview, buffers)
for writeable, mv in zip(header["writeable"], memoryviews):
if writeable == mv.readonly:
for w, mv in zip(writeable, memoryviews):
if w == mv.readonly:
if mv.readonly:
mv = memoryview(bytearray(mv))
else:
Expand All @@ -77,6 +81,7 @@ def pickle_loads(header, frames):
else:
mv = mv.cast(mv.format)
new.append(mv)

return pickle.loads(x, buffers=new)


Expand Down