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

PerspectiveManager no longer treats str as bytes in Python 2 #965

Merged
merged 1 commit into from
Mar 9, 2020
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
7 changes: 5 additions & 2 deletions python/perspective/perspective/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,11 @@ def _process_method_call(self, msg, post_callback, client_id):
elif msg["method"] != "delete":
# otherwise parse args as list
result = getattr(table_or_view, msg["method"])(*args)
if type(result) == bytes:
# return result to the client without JSON serialization
if isinstance(result, bytes) and msg["method"] != "to_csv":
# return a binary to the client without JSON serialization,
# i.e. when we return an Arrow. If a method is added that
# returns a string, this condition needs to be updated as
# an Arrow binary is both `str` and `bytes` in Python 2.
self._process_bytes(result, msg, post_callback)
else:
# return the result to the client
Expand Down