-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix 'BYTES' field handling on Py3k. #2818
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
Fix 'BYTES' field handling on Py3k. #2818
Conversation
| if _not_null(value, field): | ||
| return base64.decodestring(value) | ||
| return base64.decodestring( | ||
| value.encode('ascii') if isinstance(value, six.text_type) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
dhermes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please use the core helper
JSON decodes the base64-encoded bits as text, which cannot be passed to 'base64.decodestring' on Py3k.
|
@tseaver: See "but please use the core helper" |
|
@dhermes I updated it (via |
| if _not_null(value, field): | ||
| return base64.decodestring(value) | ||
| return base64.decodestring( | ||
| _to_bytes(value) if isinstance(value, six.text_type) else value) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Follow-up to #2818, use _to_bytes as intended in BigQuery.
…tes-field Fix 'BYTES' field handling on Py3k.
Follow-up to googleapis#2818, use _to_bytes as intended in BigQuery.
JSON decodes the base64-encoded bits as text, which cannot be passed to 'base64.decodestring' on Py3k.
tox -e system-tests3was failing for me locally before this patch, and passes with it.