udf.agent python 2.7 and 3 compatibility #2225
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is based upon multiple existing PRs. It includes the changes from #1355 and #1750 and also the changed imports from #1799 to keep python 2.7 compatibility (which will retire soon, anyways). Additionally #1750 missed one of the branches in the
if
, also breaking python 2 compatibility.The size varint prefixing protobuffer messages used to be converted to/from int using
ord
andchar
, which is not their intended purpose and leads to encoding problems under python 3 if the value is bigger than 127. The recommended way to do this in a portable way is usingstruct.pack
andunpack
.Tested under python 2.7 and 3.6. Fixes #1868. Closes #1355, closes #1750, closes #1799.
Required for all non-trivial PRs