title: RuntimeError: lost sys.stdout
body: <p>I was trying to debug an issue with <code>abc.ABCMeta</code> - in particular a subclass check that didn't work as expected and I wanted to start by simply adding a <code>print</code> to the <code>__subclasscheck__</code> method (I know there are better ways to debug code, but pretend for the sake of this question that there's no alternative). However when starting Python afterwards Python crashes (like a segmentation fault) <strong>and</strong> I get this exception:</p>
  
  <pre><code>Fatal Python error: Py_Initialize: can't initialize sys standard streams
  Traceback (most recent call last):
    File "C:\...\lib\io.py", line 84, in &lt;module&gt;
    File "C:\...\lib\abc.py", line 158, in register
    File "C:\...\lib\abc.py", line 196, in __subclasscheck__
  RuntimeError: lost sys.stdout
  </code></pre>
  
  <p>So it probebly wasn't a good idea to put the <code>print</code> in there. But where exactly does the exception come from? I only changed Python code, that shouldn't crash, right?</p>
  
  <p>Does someone know where this exception is coming from and if/how I can avoid it but still put a <code>print</code> in the <code>abc.ABCMeta.__subclasscheck__</code> method? </p>
  
  <p>I'm using Windows 10, Python-3.5 (just in case it might be important).</p>