[PyQt] SEGV in QTextStream.atEnd on Mac OS
David Cortesi
davecortesi at gmail.com
Mon Aug 29 19:32:01 BST 2011
The following code will reliably produce a crash on my Mac OS 10.6.8 (snow
leopard) system. Python 2.6.1.
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future_builtins import *
from PyQt4.QtCore import (QFile, QTextStream, QString)
ts = QTextStream(QString(u"hello\n sailor\n"),QFile.ReadOnly)
print(ts.atEnd())
qs = ts.readAll()
print(u'a. {0}:{1}'.format(qs.length(),qs))
print(ts.atEnd())
ts = QTextStream(QString(u"hello\n sailor\n"),QFile.ReadOnly)
print(ts.atEnd())
The printed output preceding the crash is usually,
False
a. 0:
True
But sometimes the displayed data is longer and contains garbage characters.
The crash report starts,
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000011
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 QtCore 0x000000010149d744
QTextStream::atEnd() const + 20
1 QtCore.so 0x000000010113d194
meth_QTextStream_atEnd + 100
2 org.python.python 0x0000000100089187 PyEval_EvalFrameEx
+ 15317
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110829/ab186426/attachment.html>
More information about the PyQt
mailing list