launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26246
[Merge] ~cjwatson/launchpad:py3-xmlrpc-client-binary-data into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-xmlrpc-client-binary-data into launchpad:master.
Commit message:
Fix extraction of bytes from xmlrpc.client.Binary
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397683
`bytes(obj)` works on Python 2, but on Python 3 we need the more portable form `obj.data`.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-xmlrpc-client-binary-data into launchpad:master.
diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py
index 589c1f3..5cb6cb2 100644
--- a/lib/lp/buildmaster/interactor.py
+++ b/lib/lp/buildmaster/interactor.py
@@ -548,12 +548,12 @@ class BuilderInteractor(object):
if builder_status == "BuilderStatus.ABORTING":
logtail = u"Waiting for slave process to be terminated"
elif slave_status.get("logtail") is not None:
- # slave_status["logtail"] is normally an xmlrpc_client.Binary
- # instance, and the contents might include invalid UTF-8 due to
- # being a fixed number of bytes from the tail of the log. Turn
- # it into Unicode as best we can.
- logtail = bytes(
- slave_status.get("logtail")).decode("UTF-8", errors="replace")
+ # slave_status["logtail"] is an xmlrpc_client.Binary instance,
+ # and the contents might include invalid UTF-8 due to being a
+ # fixed number of bytes from the tail of the log. Turn it into
+ # Unicode as best we can.
+ logtail = slave_status.get("logtail").data.decode(
+ "UTF-8", errors="replace")
# PostgreSQL text columns can't contain \0 characters, and since
# we only use this for web UI display purposes there's no point
# in going through contortions to store them.