[PyKDE] A little bug chasing story

Gey-Hong Gweon gweon at umich.edu
Fri Mar 31 06:31:00 BST 2000

Dear Phil,

Today, I have upgraded PyKDE to 0.11, and it seems to solve the parent()
and children() problem I once reported. However, I was having a more
subtle problem this time. Instead of posting a clueless question, I
decided to chase this problem a little bit, so here I report what I
found so far. I hope you will fix the problem, if you think I found a
bug indeed.

The subtle problem I had was this: children() method would return
perfectly sensible return values when my program started but then "after 
a while" it would return completely wrong values.

By inserting a few lines in the source codes for PyQt and sip, I noticed
that this happens exactly when the table size of "cppPyMap" (siplib.c)
increases from 131 to 257. At the same time, completely wrong values
were returned by sipMapCppToSelf().

After a little bit more chasing, I discovered that the problem lies in
the hash code (objmap.c) used to access cppPyMap. The table size has
increased, but the hash code is still computed as cpp_address %
table_size, which is not the same as cpp_address % old_table_size, the
correct code for the entries that already existed before the table size

Gey-Hong Gweon
The University of Michigan, Physics Department, Ann Arbor, MI 48109
(734) 647-9434 (Office), 763-3417 (Lab), 763-9694 (Fax) 

More information about the PyQt mailing list