This addresses a UnicodeEncodeError when using Python 3.6.5 in Windows
10.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
While the test suite was already passing for me in Windows and Ubuntu using either Python 2 or 3, it raised an exception when passing -a to lit (or if the test suite failed and managed to print output containing special characters) in Ubuntu when using Python 2. This change fixes that.
Also rebased onto a more recent master.
Comment Actions
I have a failure on my bot for tools/llvm-ar/mri-utf8.test ; and this patch is making it worse.
Without this patch I have:
: 'RUN: at line 23'; env LANG=en_US.UTF-8 "/usr/bin/python" -c "assert open(u'\U000000A3.txt', 'rb').read() == b'contents\n'" -- Exit Code: 1 Command Output (stderr): -- Traceback (most recent call last): File "<string>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in range(128) --
I suspect en_US.UTF-8 is just not available on the system.
After this patch however the error becomes:
[3110/3111] Running the LLVM regression tests
-- Testing: 34143 tests, 64 workers --
FAIL: LLVM :: tools/llvm-ar/mri-utf8.test (32130 of 34143)
******************** TEST 'LLVM :: tools/llvm-ar/mri-utf8.test' FAILED ********************
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 408, in _handle_results
cache[job]._set(i, obj)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 577, in _set
self._callback(self._value)
File "/var/lib/buildkite-agent/builds/buildkite-6dd7db7bf5-rcq8r-1/mlir/llvm-coverage/llvm/utils/lit/lit/run.py", line 136, in <lambda>
callback=lambda r, t=test: self._process_result(t, r))
File "/var/lib/buildkite-agent/builds/buildkite-6dd7db7bf5-rcq8r-1/mlir/llvm-coverage/llvm/utils/lit/lit/run.py", line 82, in _process_result
self.progress_callback(test)
File "/var/lib/buildkite-agent/builds/buildkite-6dd7db7bf5-rcq8r-1/mlir/llvm-coverage/llvm/utils/lit/lit/main.py", line 194, in progress_callback
display.update(test)
File "/var/lib/buildkite-agent/builds/buildkite-6dd7db7bf5-rcq8r-1/mlir/llvm-coverage/llvm/utils/lit/lit/display.py", line 52, in update
self.print_result(test)
File "/var/lib/buildkite-agent/builds/buildkite-6dd7db7bf5-rcq8r-1/mlir/llvm-coverage/llvm/utils/lit/lit/display.py", line 85, in print_result
out = out.decode(encoding=sys.stdout.encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 492: ordinal not in range(128)And lit will just hang there forever.
Comment Actions
Can you please try adding an errors='ignore' argument to the failing decode call? Or I can push a patch if that's easier. Thanks.