-
Notifications
You must be signed in to change notification settings - Fork 110
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
Python 2 / 3 compatibility changes #263
Conversation
….write." This reverts commit 2936ae2.
Most instances require binary text but a few require unicode string in python 3.x.
Between Python 3.0 and 3.5, json.load and json.loads only accepted unicode string format. Change was made in 3.6 to automatically adapt to both unicode and bytes formats. https://docs.python.org/3/whatsnew/3.6.html#json
Fix to MD5 hashing issue on Python 3.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
Note that both Joe and I have signed CLAs, but googlebot gets a little upset with multiple authors. ✍️ |
- Changed docstring to have appropriate spacing - Changed docstring to be less then 80 chars long - Updated six in setup.py to be >= v1.12
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
* Using six.ensure_binary() in write command * Updated response.content to be coerced to a string for stream.write. * Adding exception block to catch streams that require string Most instances require binary text but a few require unicode string in python 3.x. * Ensuring string format before json.loads() Between Python 3.0 and 3.5, json.load and json.loads only accepted unicode string format. Change was made in 3.6 to automatically adapt to both unicode and bytes formats. https://docs.python.org/3/whatsnew/3.6.html#json * Cherrypicking ed's Changes - MultipartBytesGenerator Fix to issue on Python 3 where certain sequences of bytes would be incorrectly mutated (the generator would consider it a line ending that needed to be changed to what it considered the "correct" characters). * Linting fixes, updated dependency six version - Changed docstring to have appropriate spacing - Changed docstring to be less then 80 chars long - Updated six in setup.py to be >= v1.12
@walkerjoe and I made several small fixes to help apitools be cross-compatible with Python 2 and 3. These issues were identified while working on making gsutil's py-six-current branch compatible with Python 2.7 and 3.5+. This was done under the guidance of @houglum
Notably, we're using the six library to help ensure byte strings vs unicode strings work together nicely.
Email generator had some small text encoding issues with generating text in Python 3.5+, so we added
MultipartBytesGenerator
method to alleviate the issue.Let us know if you have any questions about these changes! 🙂