[PATCH] D68985: [LNT] Python 3 support: requests.response as text
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 07:10:29 PDT 2019
thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D68938: [LNT] Python 3 support: subprocess IO as text.
lnt admin rm-machine command prints output from the REST API for
deleting machine line by line using requests.response's iter_lines()
method. However in Python 3 this method returns data by default and
printing expects a string. This commit uses the text attribute for
requests.response and iterate over the lines with splitlines.
https://reviews.llvm.org/D68985
Files:
lnt/lnttool/admin.py
Index: lnt/lnttool/admin.py
===================================================================
--- lnt/lnttool/admin.py
+++ lnt/lnttool/admin.py
@@ -188,7 +188,7 @@
.format(machine=machine, **config.dict))
response = config.session.delete(url, stream=True)
_check_response(response)
- for line in response.iter_lines():
+ for line in response.text.splitlines():
sys.stdout.write(line + '\n')
sys.stdout.flush()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68985.225026.patch
Type: text/x-patch
Size: 460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/f92b410a/attachment.bin>
More information about the llvm-commits
mailing list