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

Some bytes/str issues in py3 w/ zlib and json #2034

Closed
wants to merge 25 commits into from

Conversation

wyndhblb
Copy link
Contributor

zlib wants bytes, json wants strings ...

@bkyryliuk
Copy link
Member

@wyndhblb - could u please add a test to demonstrate the issue?
It would be great to prevent the regression.

@wyndhblb
Copy link
Contributor Author

sure let me refactor things a bit first

@xrmx
Copy link
Contributor

xrmx commented Jan 25, 2017

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.

@wyndhblb
Copy link
Contributor Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: missing return char at EOF

@mistercrunch
Copy link
Member

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
@mistercrunch
Copy link
Member

can we keep the formatting things outside this PR, codeclimate doesn't seem to agree with your auto-formatter.

@rumbin
Copy link
Contributor

rumbin commented Apr 5, 2017

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.

@mistercrunch
Copy link
Member

This PR needs to:

  • rebase
  • remove all of the unnecessary formatting/indent changes
  • pass the build

@rumbin
Copy link
Contributor

rumbin commented Apr 5, 2017

See alternative PR #2558, as this one doesn't seem to move on.

@mistercrunch
Copy link
Member

superseeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants