<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - LLVM messing up NCurses-based applications"
   href="https://llvm.org/bugs/show_bug.cgi?id=22981">22981</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM messing up NCurses-based applications
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>me@jmendeth.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When trying to use the Clang Python bindings inside bpython, every time I
loaded a TranslationUnit from source, bpython segfaulted.

I've found the problem to be in
llvm::sys::Process::FileDescriptorHasColors(int). It uses terminfo to check if
the file descriptor has colors, but instead of restoring the `cur_term`
variable to its original value, it sets it to NULL. When control returns to the
NCurses app (bpython), it crashes because no current terminal is set.

This is the first time I ever deal with LLVM or NCurses code, so I might be
wrong. I did a search to see if this had been reported before, but I didn't
find anything.



To reproduce, fire up bpython and enter:

    import clang.cindex
    clang.cindex.TranslationUnit.from_source("path to some C file")

You need the Clang Python bindings installed, of course.</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>