[PyQt] QTextBlockUserData forgotten in SIP 4.14.3, bug?

Wilbert Berendsen wbsoft at xs4all.nl
Tue Mar 12 08:20:48 GMT 2013


Op Mon, 11 Mar 2013 14:01:21 +0000
Phil Thompson <phil at riverbankcomputing.com> schreef:

> On Mon, 11 Mar 2013 11:13:15 +0100, Wilbert Berendsen
> <wbsoft at xs4all.nl> wrote:
> > Hi,
> > 
> > It seems sip 4.14.3 forgets QTextUserData objects.
> > (...)
> > Note that it isn't forgotten that there is a QTextUserData set, but
> > it is returned as a different object, without the 'value' attribute
> > that was previously set.
> > 
> > Is this a bug?
> 
> It's a PyQt bug - fixed in tonight's snapshot.

I tried to work around the bug, but that seems not to be possible. Even
when deriving from QTextBlockUserData, the python wrapper is lost when
requesting the same object later. Sometime it lives for a few seconds
but eventually it dies, forgetting the Python attributes that were set.

I see, besides Frescobaldi[1], also Ninja[2] suffering from this
problem.
[1] https://github.com/wbsoft/frescobaldi
[2] https://github.com/ninja-ide/ninja-ide

In the case of Frescobaldi, the bug is quite severe: Frescobaldi
tokenizes all entered text, caching the tokens (created by a
QSyntaxHighlighter) in the QTextBlockUserData for every line of text.
Due to this bug the parser runs every time on the whole document, as
the parsing state is also lost, causing slowdowns of minutes...

The QTextBlockUserData is the only place where custom information can
be attached to text lines. I don't know of any other way to store
information relating to text blocks.

Could the fix for this bug also be forwarded to Linux packagers soon, as
many new Linux distros now package recent PyQt4 versions?

If I can help, I'd be grateful.

best wishes,
Wilbert

-- 
Wilbert Berendsen
(http://www.wilbertberendsen.nl)



More information about the PyQt mailing list