QTextBlockUserData loses its data

Bug #1161818 reported by Julian Taylor
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ipython (Ubuntu)
Fix Released
Medium
Julian Taylor
Raring
Fix Released
Medium
Julian Taylor
python-qt4 (Ubuntu)
Fix Released
High
Dimitri John Ledkov
Raring
Fix Released
High
Dimitri John Ledkov

Bug Description

in pyqt4 4.10 QTextBlockUserData is broken.
see
http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032457.html

from PyQt4.QtGui import QTextDocument, QTextBlockUserData
doc=QTextDocument()
data=QTextBlockUserData()
data.value = 123
doc.firstBlock().setUserData(data)
del data
import gc
gc.collect()
print doc.firstBlock().userData().value

AttributeError: 'QTextBlockUserData' object has no attribute 'value'

example in archive
ipython qtconsole
type:
if 1:
  print 1

and you get lots of tracebacks in the terminal:
  File "/usr/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'

it also breaks ninja ide.

Revision history for this message
Julian Taylor (jtaylor) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

In iPython ther is also:
            if QtCore.PYQT_VERSION_STR < '4.7':
                # PyQt 4.6 has issues with null strings returning as None
                raise ImportError

Which is also wrong:
ipython -c "import PyQt4; from PyQt4 import QtCore, QtGui, QtSvg; print(QtCore.PYQT_VERSION_STR < '4.7')"

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

prints True, which results in an ImportError.

Revision history for this message
Julian Taylor (jtaylor) wrote :

That will be fixed next release due soon, just comment it out to reproduce the other issue
you also have to change QtGui.QTextDocument() to self.document() in /usr/lib/python3/dist-packages/IPython/frontend/qt/console/pygments_highlighter.py:97 to fully fix this issue

description: updated
Julian Taylor (jtaylor)
description: updated
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I think I'm going to take this patch for version comparison:
https://github.com/ipython/ipython/commit/045580593304a61505d842c9cde2d32d80dfbbb6.patch

Changed in python-qt4 (Ubuntu):
status: New → Fix Committed
assignee: nobody → Dmitrijs Ledkovs (xnox)
importance: Undecided → High
Changed in ipython (Ubuntu):
assignee: nobody → Julian Taylor (jtaylor)
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

unsubscribing sponsors.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-qt4 - 4.10-0ubuntu2

---------------
python-qt4 (4.10-0ubuntu2) raring; urgency=low

  * backport fix-QTextBlockUserData.patch from upstream snapshot
    fixes e.g. syntax highlighting in editors (LP: #1161818)
 -- Julian Taylor <email address hidden> Fri, 29 Mar 2013 14:35:15 +0000

Changed in python-qt4 (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ipython - 0.13.2~rc2-1

---------------
ipython (0.13.2~rc2-1) experimental; urgency=low

  * New upstream release candidate (LP: #1161818, #1162112)
  * pass -a to xvfb-run
  * drop DM-Upload-Allowed, not needed anymore
  * don't link documentation of ipython-doc so ipython3 does not depend on
    ipython (Closes: #695554)
    Requires ipython-doc.preinst to not lose copyright on upgrade
  * add ipython3 and ipython3-qtconsole desktop files (Closes: #693612)
  * fix detection of cython modules for multiarch python (Closes: #697704)
  * don't install tests for notebook and qtconsole
  * bump standard to 3.9.4, no changes required
  * add autopkgtests running testsuite and testing tools, cython magics
    and incomplete install message
  * fix crash on tracebacks without line numbers (Closes: #701597)
  * add tkinter package to debianize-error-messages.patch (Closes: #701707)
  * use canonical vcs fields in control

 -- Julian Taylor <email address hidden> Sat, 02 Feb 2013 11:14:27 +0100

Changed in ipython (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Jonathan Riddell (jr) wrote :

reopening because it causes a build failure with pykde, querying with upstream

Changed in python-qt4 (Ubuntu):
status: Fix Released → In Progress
Matthias Klose (doko)
Changed in python-qt4 (Ubuntu Raring):
milestone: none → ubuntu-13.04
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-qt4 - 4.10-0ubuntu3

---------------
python-qt4 (4.10-0ubuntu3) raring; urgency=low

  * Update fix-QTextBlockUserData.patch with fix from upstream
    to allow PyKDE to compile (LP: #1161818)
 -- Jonathan Riddell <email address hidden> Mon, 08 Apr 2013 15:46:19 +0100

Changed in python-qt4 (Ubuntu Raring):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.