title: PySide crashing Python when emitting None between threads
body: <p><strong>[edit]</strong> This is not a pure duplicate of the <a href="https://stackoverflow.com/questions/8795753/pyside-emit-signal-causes-python-to-crash">PySide emit signal causes python to crash</a> question. This question relates specifically to a (now) <a href="https://bugreports.qt-project.org/browse/PYSIDE-17" rel="nofollow noreferrer">known bug in PySide preventing None from being passed across threads</a>. The other question relates to hooking up signals to a spinner box. I've updated the title of this question to better reflect the problem I was facing. <strong>[/edit]</strong></p>
  
  <p>I've banged my head against a situation where PySide behaves subtly different from PyQt. Well, I say subtly but actually PySide <em>crashes</em> Python whereas PyQt works as I expect.</p>
  
  <p><img src="https://i.stack.imgur.com/9UYjt.png" alt="Under PySide my app crashes"></p>
  
  <p>I'm completely new to PySide and still fairly new to PyQt so maybe I'm making some basic mistake, but damned if I can figure it out... really hoping one of you fine folks can give some pointers!</p>
  
  <p>The full app is a batch processing tool and much too cumbersome to describe here, but I've stripped the problem down to its bare essentials in the code-sample below:</p>
  
  <pre><code>import threading
  
  try:
      # raise ImportError()  # Uncomment this line to show PyQt works correctly
      from PySide import QtCore, QtGui
  except ImportError:
      from PyQt4 import QtCore, QtGui
      QtCore.Signal = QtCore.pyqtSignal
      QtCore.Slot = QtCore.pyqtSlot
  
  
  class _ThreadsafeCallbackHelper(QtCore.QObject):
      finished = QtCore.Signal(object)
  
  
  def Dummy():
      print "Ran Dummy"
      # return ''  # Uncomment this to show PySide *not* crashing
      return None
  
  
  class BatchProcessingWindow(QtGui.QMainWindow):
      def __init__(self):
          QtGui.QMainWindow.__init__(self, None)
  
          btn = QtGui.QPushButton('do it', self)
          btn.clicked.connect(lambda: self._BatchProcess())
  
      def _BatchProcess(self):
          def postbatch():
              pass
          helper = _ThreadsafeCallbackHelper()
          helper.finished.connect(postbatch)
  
          def cb():
              res = Dummy()
              helper.finished.emit(res)  # `None` crashes Python under PySide??!
          t = threading.Thread(target=cb)
          t.start()
  
  
  if __name__ == '__main__':  # pragma: no cover
      app = QtGui.QApplication([])
      BatchProcessingWindow().show()
      app.exec_()
  </code></pre>
  
  <p>Running this displays a window with a "do it" button. Clicking it crashes Python if running under PySide. Uncomment the <code>ImportError</code> on line 4 to see PyQt* correctly run the Dummy function. Or uncomment the <code>return</code> statement on line 20 to see <em>PySide</em> correctly run.</p>
  
  <p>I don't understand why emitting <code>None</code> makes Python/PySide fail so badly?</p>
  
  <p>The goal is to offload the processing (whatever Dummy does) to another thread, keeping the main GUI thread responsive. Again this has worked fine with PyQt but clearly not so much with PySide.</p>
  
  <p>Any and all advice will be super appreciated.</p>
  
  <p>This is under:</p>
  
  <pre><code>    Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
  
      &gt;&gt;&gt; import PySide
      &gt;&gt;&gt; PySide.__version_info__
      (1, 1, 0, 'final', 1)
  
      &gt;&gt;&gt; from PyQt4 import Qt
      &gt;&gt;&gt; Qt.qVersion()
      '4.8.2'
  </code></pre>