Some bytes/str issues in py3 w/ zlib and json#2034
Conversation
print("GIT SHA: " + GIT_SHA)
TypeError: Can't convert 'NoneType' object to str implicitly
|
@wyndhblb - could u please add a test to demonstrate the issue? |
|
sure let me refactor things a bit first |
|
I think it would be better that instead of being sloppy on how we call functions and adding wrappers that handles all the the types we just have more care and pass the right types around. |
|
sure (python 2+3 makes that hard w/ the type differences) ... six could help, but the default six.b/u does latin-1 and that's not a good encoding default for most modern DBs. |
| json_str = """{"test": 1}""" | ||
| blob = zlib_compress(json_str) | ||
| got_str = zlib_uncompress_to_string(blob) | ||
| self.assertEquals(json_str, got_str) No newline at end of file |
There was a problem hiding this comment.
NIT: missing return char at EOF
|
This LGTM though there's a conflict, please rebase. [optional] These pure function are nice to test as doctests so that you have an example that is also a test in the docstring. The way things are hooked up it's also accounted for in code coverage analysis. |
# Conflicts: # superset/utils.py # superset/views.py
# Conflicts: # superset/utils.py # superset/views.py
|
can we keep the formatting things outside this PR, codeclimate doesn't seem to agree with your auto-formatter. |
|
What can be done to get this merged? This bug is effectively keeping me from switching to Python 3 (see #2079), which I would love to do, as Python 2 has its encoding issues of its own that I'm struggling with. |
|
This PR needs to:
|
|
See alternative PR #2558, as this one doesn't seem to move on. |
|
superseeded |
zlib wants bytes, json wants strings ...