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

udf.agent python 2.7 and 3 compatibility #2225

Closed
wants to merge 4 commits into from

Conversation

N-Coder
Copy link

@N-Coder N-Coder commented Jun 25, 2019

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 and char, 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 using struct.pack and unpack.

Tested under python 2.7 and 3.6. Fixes #1868. Closes #1355, closes #1750, closes #1799.

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated
  • Sign CLA (if not already signed)

nathanielc and others added 4 commits May 3, 2017 10:01
When using stdin and stdout use the buffer attribute in order to be able
to send binary strings rather than text.
this is compatible with both python 2 and 3 and has no encoding issues
@N-Coder
Copy link
Author

N-Coder commented Jun 25, 2019

When merging this, you could also merge #2158 / #2070, closing #2069.

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.

Kapacitor UDF in Python 3
3 participants