Fix two exceptions encountered when running tests
I ran into two different exceptions when running tests,
which end up using python2.
This CL fixed them for me.
In one case, we were calling encode() on a str,
which produced an exception:
ascii' codec can't decode byte 0xe2 in position 0...
In another case, 'result' was None, so result[0]
failed.
Change-Id: I4764444303e1dbd8001f2a872c9905e3331e22f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3209653
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929246}
NOKEYCHECK=True
GitOrigin-RevId: 8c06bd21794233114ebae335c7f8abe1b6550620
diff --git a/development/scripts/stack_core.py b/development/scripts/stack_core.py
index a61e95a..bd1a08b 100755
--- a/development/scripts/stack_core.py
+++ b/development/scripts/stack_core.py
@@ -227,8 +227,9 @@
useful_log = []
so_dirs = []
for result in results:
- useful_log += result[0]
- so_dirs += result[1]
+ if result is not None:
+ useful_log += result[0]
+ so_dirs += result[1]
if use_multiprocessing:
pool.close()
@@ -320,7 +321,11 @@
"""
useful_log = []
for ln in lines:
- line = ln.encode().decode(encoding='utf8', errors='ignore')
+ if sys.version_info.major == 3:
+ line = ln
+ else:
+ line = ln.decode(encoding='utf8', errors='ignore')
+
if (_PROCESS_INFO_LINE.search(line)
or _SIGNAL_LINE.search(line)
or _REGISTER_LINE.search(line)