ipython pyqt 4.10 incompatibilty, QTextBlockUserData #3084

Closed
juliantaylor opened this Issue Mar 26, 2013 · 0 comments

Projects

None yet

1 participant

@juliantaylor

ipython qtconsole seems to be incompatible with pytqt 4.10, if you type in a line you get this

if 1:
   print 1

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/qt/console/frontend_widget.py", line 59, in highlightBlock
    super(FrontendHighlighter, self).highlightBlock(string)
  File "/usr/lib/python2.7/dist-packages/IPython/frontend/qt/console/pygments_highlighter.py", line 109, in highlightBlock
    self._lexer._saved_state_stack = prev_data.syntax_stack
AttributeError: 'QTextBlockUserData' object has no attribute 'syntax_stack'

this needs to be fixed in two places, pyqt needs an update (currently available as snapshot) and ipython needs a fix in pygments_highlighter.py

self._document = QtGui.QTextDocument()

...to...

self._document = self.document()

see:
http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032512.html

@minrk minrk added a commit that closed this issue Mar 31, 2013
@minrk minrk use self._document = self.document()
in PygmentsHighlighter, for PyQt 4.10 compatibility

see [PyQt list](http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032512.html)
for details.

closes #3084
04c4279
@minrk minrk closed this in 04c4279 Mar 31, 2013
@minrk minrk added a commit that referenced this issue Mar 31, 2013
@minrk minrk Backport PR #3097: PyQt 4.10: use self._document = self.document()
in PygmentsHighlighter, required for PyQt 4.10 compatibility.

closes #3084

I have tested this on all my machines with earlier PyQt and PySide, and it doesn't break anything.  I don't have any truly old versions of PyQt, though.

see [PyQt list](http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032512.html) for details.
d31ebe2
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@minrk minrk use self._document = self.document()
in PygmentsHighlighter, for PyQt 4.10 compatibility

see [PyQt list](http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032512.html)
for details.

closes #3084
d1d41d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment