[PyKDE] Bug#378086: python-qt4-doc: simpletreemodel.py demo does not work on AMD64

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 13 12:38:34 BST 2006

On Thursday 13 July 2006 8:54 am, Alexandre Fayolle wrote:
> Package: python-qt4-doc
> Version: 4.0-2
> Severity: normal
> Hi,
> While trying to run the itemview demos on an AMD64 computer I ran into a
> problem: the QModelIndex are built by passing the id() of a python object
> (which is a C long integer) and the Qt API requires an int. The value
> returned by index.internalId() is truncated to an int, and this value is
> used to make a lookup in a python dictionary which was built using the
> original 64bit value, and therefore we get a KeyError and the demo does not
> work:
> simpletreemodel$ python simpletreemodel.py
> Traceback (most recent call last):
>   File "simpletreemodel.py", line 119, in parent
>     childItem = self.object_dict[index.internalId()]
> KeyError: -414219776L
> Traceback (most recent call last):
>   File "simpletreemodel.py", line 87, in data
>     item = self.object_dict[index.internalId()]
> KeyError: -414219776L
> <snip>
> I tried to use index.internalPointer() which returns a reference on the
> python instance being referenced by the model index. This works on i386,
> and segfaults on AMD64. And I am afraid that this can lead to strange
> things on i386 if the TreeItem is garbage collected.
> I'm CC'ing this bug report the pykde mailing list, where people may have an
> opinion on that matter.

It's fixed in the relevant examples in current PyQt4 snapshots.


More information about the PyQt mailing list