The following code will reliably produce a crash on my Mac OS 10.6.8 (snow leopard) system. Python 2.6.1.<br><br><span style="font-family: courier new,monospace;">from __future__ import division</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from __future__ import print_function</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">from __future__ import unicode_literals</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">from future_builtins import *</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">from PyQt4.QtCore import (QFile, QTextStream, QString)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ts = QTextStream(QString(u"hello\n sailor\n"),QFile.ReadOnly)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">print(ts.atEnd())</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">qs = ts.readAll()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">print(u'a. {0}:{1}'.format(qs.length(),qs))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print(ts.atEnd())</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">ts = QTextStream(QString(u"hello\n sailor\n"),QFile.ReadOnly)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">print(ts.atEnd())</span><br>
<br>The printed output preceding the crash is usually,<br>False<br>a. 0:<br>True<br>But sometimes the displayed data is longer and contains garbage characters.<br><br>The crash report starts,<br>Exception Type: EXC_BAD_ACCESS (SIGSEGV)<br>
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000011<br>Crashed Thread: 0 Dispatch queue: com.apple.main-thread<br><br>Thread 0 Crashed: Dispatch queue: com.apple.main-thread<br>0 QtCore 0x000000010149d744 QTextStream::atEnd() const + 20<br>
1 QtCore.so 0x000000010113d194 meth_QTextStream_atEnd + 100<br>2 org.python.python 0x0000000100089187 PyEval_EvalFrameEx + 15317<br><br>