[PyQt] QTextBlockUserData forgotten in SIP 4.14.3, bug?

Phil Thompson phil at riverbankcomputing.com
Tue Mar 26 15:49:30 GMT 2013


On Fri, 22 Mar 2013 20:50:40 +0100, Julian Taylor
<jtaylor.debian at googlemail.com> wrote:
>> I'll make a new release sooner rather than later. I do invite people to
>> test current snapshots before making a release but I suspect people
>> rarely
>> do.
>> 
>> Phil
> 
> hi,
> the ipython qtconsole 0.13.1 and current git head has this issue since
> 4.10 too and it is not fixed by the latest snapshot.
> 
> $ python -c "from PyQt4.pyqtconfig import Configuration; print
> Configuration().pyqt_version_str"
> snapshot-4.10.1-19c32f448665
> 
> 
> $ ipython qtconsole
> 
> if 1:
>   print 1
> 
> and you get lots of tracebacks of this type:
> 
> Traceback (most recent call last):
>   File
>
"/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/console/frontend_widget.py",
> line 59, in highlightBlock
>     super(FrontendHighlighter, self).highlightBlock(string)
>   File
>
"/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/console/pygments_highlighter.py",
> line 107, in highlightBlock
>     self._lexer._saved_state_stack = prev_data.syntax_stack
> AttributeError: 'QTextBlockUserData' object has no attribute
'syntax_stack'
> 
> 
> I tried the latest snapshot
> (PyQt-x11-gpl-snapshot-4.10.1-19c32f448665.tar.gz, what I believe is the
> relevant diff is attached) but it did not fix the issue.
> Is this another bug or an intentional change?

It's an IPython bug. In PygmentsHighlighter.__init__() in
pygments_highlighter.py change...

    self._document = QtGui.QTextDocument()

...to...

    self._document = self.document()

Phil


More information about the PyQt mailing list