Add Python 3 compatibility for rbssh.

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

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).

Summary ID
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
Description From Last Updated

E402 module level import not at top of file

reviewbotreviewbot

E402 module level import not at top of file

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (9555cf1)