[PyKDE] Bug#378086: python-qt4-doc: simpletreemodel.py demo does
not work on AMD64
Alexandre Fayolle
afayolle at debian.org
Thu Jul 13 08:54:54 BST 2006
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.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-amd64-k8-smp
Locale: LANG=fr_FR at euro, LC_CTYPE=fr_FR at euro (charmap=ISO-8859-15) (ignored: LC_ALL set to fr_FR at euro)
-- no debconf information
More information about the PyQt
mailing list