You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2018/10/05 20:40:06 UTC
[mesos] branch master updated: Fixed bug in `verify-reviews` due to
mismatched types.
This is an automated email from the ASF dual-hosted git repository.
vinodkone pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new 5b348b6 Fixed bug in `verify-reviews` due to mismatched types.
5b348b6 is described below
commit 5b348b6070f0d0403cb69b6a7fa638fc46b7ff49
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
AuthorDate: Fri Oct 5 15:39:49 2018 -0500
Fixed bug in `verify-reviews` due to mismatched types.
Because Python is not type-safe, we encountered a bug in the code
executed on non-Windows platforms that was expecting `output` to be a
normal Python string instead of a Python byte string (with encoded
content). To fix this, we now always decode the bytes into a string,
so that the logic afterwards only has one type to deal with.
Review: https://reviews.apache.org/r/68826/
---
support/verify-reviews.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/support/verify-reviews.py b/support/verify-reviews.py
index 72b7eb5..56321ae 100755
--- a/support/verify-reviews.py
+++ b/support/verify-reviews.py
@@ -195,10 +195,12 @@ def verify_review(review_request, handler):
# If we are here because the docker build command failed, read the
# output from `build_output` file. For all other command failures read
# the output from `e.output`.
+ #
+ # Decode the RHS so that `output` is always a string.
if os.path.exists(build_output):
- output = open(build_output).read()
+ output = open(build_output).read().decode(sys.stdout.encoding)
else:
- output = err.output
+ output = err.output.decode(sys.stdout.encoding)
if platform.system() == 'Windows':
# We didn't output anything during the build (because `tee`
@@ -208,7 +210,7 @@ def verify_review(review_request, handler):
# fixed in pylint 1.7.
# TODO(ArmandGrillet): Remove this once pylint updated to >= 1.7.
# pylint: disable=no-member
- sys.stdout.buffer.write(output)
+ sys.stdout.buffer.write(output.encode())
# Truncate the output when posting the review as it can be very large.
if len(output) > REVIEW_SIZE: