<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Hang when lit output redirected to file with python 3"
   href="https://bugs.llvm.org/show_bug.cgi?id=43776">43776</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Hang when lit output redirected to file with python 3
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Test Suite
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>lit
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>daniel@zuster.org, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With python 3.6.8, lit hangs if producing output with non-ascii characters and
redirecting to a file on Windows. This can happen if a test fails and has
non-ascii in the Script: output. Below I'm using the -a option to show all
output to elicit this so it doesn't need to fail.

To reproduce (with revision 689ce810598bec7b35dd7ebe33ce5c5cce1453c7)
<span class="quote">>python --version</span >
Python 3.6.8
<span class="quote">>python build/bin/llvm-lit.py llvm/test/Other -a > afile.txt</span >
llvm-lit.py: F:/git/llvm-project/llvm\utils\lit\lit\run.py:170: warning: Failed
to raise process limit: No module named 'resource'
Exception in thread Thread-5:
Traceback (most recent call last):
  File "C:\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python36\lib\multiprocessing\pool.py", line 479, in _handle_results
    cache[job]._set(i, obj)
  File "C:\Python36\lib\multiprocessing\pool.py", line 649, in _set
    self._callback(self._value)
  File "F:/git/llvm-project/llvm\utils\lit\lit\run.py", line 134, in <lambda>
    callback=lambda r, t=test: self._process_result(t, r))
  File "F:/git/llvm-project/llvm\utils\lit\lit\run.py", line 80, in
_process_result
    self.progress_callback(test)
  File "F:/git/llvm-project/llvm\utils\lit\lit\main.py", line 189, in
progress_callback
    display.update(test)
  File "F:/git/llvm-project/llvm\utils\lit\lit\display.py", line 52, in update
    self.print_result(test)
  File "F:/git/llvm-project/llvm\utils\lit\lit\display.py", line 73, in
print_result
    print(test.result.output)
  File "C:\Python36\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position
304-305: character maps to <undefined>

This should complete in a second or two but hangs instead.

This works fine with python 2.7.15, or with one thread (-j 1), or not
outputting the script with non-ascii, or not redirecting to a file.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>