Add Python 3 compatibility for rbssh.

Review Request #10475 — Created March 28, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

Python 3 changed sys.stdout and sys.stderr to require Unicode
strings, but this doesn't work so well for binary data, which rbssh
writes. Instead, we need to use the buffer attribute of both of these.

This change updates rbssh to determine the right object to write to for
Python 2 and 3. It also disables warning output, which interferes with
the communication (and is triggered quite a lot by paramiko's
interaction with cryptography).

rbssh-based unit tests pass on Python 2 and 3 (when used with other
pending changes).

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Add Python 3 compatibility for rbssh.
Python 3 changed `sys.stdout` and `sys.stderr` to require Unicode strings, but this doesn't work so well for binary data, which rbssh writes. Instead, we need to use the `buffer` attribute of both of these. This change updates rbssh to determine the right object to write to for Python 2 and 3. It also disables warning output, which interferes with the communication (and is triggered quite a lot by paramiko's interaction with cryptography).
594356ecca2b743314b86c8e587285a5077ba5f6 Christian Hammond
reviewboard/cmdline/rbssh.py
Loading...