Fix issues related to Python 3 compatibility#2125
Fix issues related to Python 3 compatibility#2125rachel-fenichel merged 3 commits intoRaspberryPiFoundation:developfrom
Conversation
|
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. |
|
Commenting for CLA check |
…/blockly into python3_further_upgrade
|
Commenting for CLA check |
|
Signed CLA with commit account as well, should hopefully work now |
|
CLAs look good, thanks! |
Port of RaspberryPiFoundation/blockly#2123 (by @gomercin) Fix issues related to Python 3 compatibility Port of RaspberryPiFoundation/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
Port of RaspberryPiFoundation/blockly#2123 (by @gomercin) Fix issues related to Python 3 compatibility Port of RaspberryPiFoundation/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
Port of RaspberryPiFoundation/blockly#2123 (by @gomercin) Fix issues related to Python 3 compatibility Port of RaspberryPiFoundation/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
The basics
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:
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.