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

Fix issues related to Python 3 compatibility #2125

Merged
merged 3 commits into from Nov 19, 2018

Conversation

gomercin
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Most changes are for except usages and paranthesis around print.
decode had to be added for Python 3.4 compatibility, in build.py#341, because of changes in return type of response.read() and supported argument types for json.loads between 2.7, 3.4 and 3.6

Resolves

Further updates following up #2112

Proposed Changes

Reason for Changes

Making remaining python files compatible with Python 2 and 3 versions.
This patch also covers Python 3.4 compatibility for build.py

Test Coverage

All files are inspected by PyCharm

build.py and dedup_json.py is tested on Ubuntu 16.04 by comparing generated files using:

  • original code with Python 2.7
  • patched code with Python 2.7
  • patched code with Python 3.4
  • patched code with Python 3.6

json_to_js and create_messages are indirectly used by build.

xliff_to_json.py is not tested but changes are not important to affect the code flow.

Additional Information

tests.py does not seem to be testing an existing function, so it might need to be removed or updated.

Using "." for relative imports are encouraged (like "from .common import InputError" ) but it makes scripts trickier to run so they are not changed.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@gomercin
Copy link
Contributor Author

Commenting for CLA check

@gomercin
Copy link
Contributor Author

Commenting for CLA check

@gomercin
Copy link
Contributor Author

Signed CLA with commit account as well, should hopefully work now

@googlebot
Copy link

CLAs look good, thanks!

@rachel-fenichel rachel-fenichel merged commit f2208a6 into google:develop Nov 19, 2018
BeksOmega added a commit to BeksOmega/blockly that referenced this pull request Jun 7, 2019
BeksOmega added a commit to BeksOmega/blockly that referenced this pull request Jun 11, 2019
tansly added a commit to tansly/scratch-blocks that referenced this pull request Jul 12, 2019
delasare pushed a commit to scratchfoundation/scratch-blocks that referenced this pull request Oct 25, 2023
Port of google/blockly#2123 (by @gomercin)

Fix issues related to Python 3 compatibility

Port of google/blockly#2125 (by @gomercin)

Fix compatibility problems with Python 3's reduce(), filter() et al.

Fix Python 3 compatibility problems related to str encodings

Remove obsolete UnicodeEncodeError handling
delasare pushed a commit to scratchfoundation/scratch-blocks that referenced this pull request Oct 25, 2023
Port of google/blockly#2123 (by @gomercin)

Fix issues related to Python 3 compatibility

Port of google/blockly#2125 (by @gomercin)

Fix compatibility problems with Python 3's reduce(), filter() et al.

Fix Python 3 compatibility problems related to str encodings

Remove obsolete UnicodeEncodeError handling
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.

None yet

3 participants